Jar files in libs folder are not used in Android Gradle build

后端 未结 2 804
春和景丽
春和景丽 2020-12-30 21:44

i just started to play with the gradle build system for Android.

However i\'m not able build one of my projects. It depends on a jar in the libs/ folder.

Doi

2条回答
  •  余生分开走
    2020-12-30 22:43

    just found the answer myself:

    Seems like the current version of the Android Gradle plugin doesn't look for jars in the libs/ folder. So you have to add them yourself:

    dependencies {
        compile files('libs/mylib.jar')
    }
    

    or

    dependencies {
        compile fileTree(dir: 'libs', include: '*.jar')
    }
    

    Place this within the android namespace like this:

    android {
        target = "android-15"
    
        dependencies {
            compile fileTree(dir: 'libs', include: '*.jar')
        }
     }
    

提交回复
热议问题