Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
726 views
in Technique[技术] by (71.8m points)

jar file not identified by android project with gradle

I have a local file {projectroot}/libs/javacsv.jar

and I include it in my build.gradle which is also in the root of my project as following

dependencies {
    classpath 'com.android.tools.build:gradle:0.7.0'
    compile fileTree(dir: 'libs', include: '*.jar')
}

however when i compile my project I still get

A problem occurred evaluating root project 'myproject'. No such property: compile for class: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler

how can i fix this i just want to compile my android project with my libs dir :/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There two dependencies sections in build.gradle:

buildscript {
    repositories {
    //repositories for build script dependencies
    }

   dependencies {
   //dependencies for build script
   }
}

apply plugin: 'android'

repositories {
//repositories for project dependencies
}

android {
....
}

dependencies {
//dependencies for project 
}

So move your libs section to correct one.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...