In your library's gradle.build
, Change the line apply plugin: com.android.application
to apply plugin: com.android.library
and remove the setApplicationId
preDexLibraries = false
}
1从git下载代码报错
error:Gradle version 1.10 is required. Current version is 2.2.1
修改系统调用的build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'}
(可以新建一个项目,修改成电脑上已经安装好的gradle版本)
2然后
Error: runProguard的不存在,
修改改成 minifyEnabled false
3如果选择第三方库,需要将之放到library目录下面,
将setting.gradle里面加入include ':library',
同时编译app的build.gradle的dependencies里面增加library的compile
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library')
}参照下面步骤:
Suppose you want to add a library (for example MyLib) to your project, You should follow these steps:
include ':MyPrj', 'Libraries:MyLib'
. Note: Current directory for this include statement is your main project folder. If you paste your project into a folder you must mention it's address relative to the main project directory. In my case I pasteMyLib into Libraries folder. This Libraries name is not a keyword and you can choose other names for it+
then choose Module dependency and there is your libraries and you can select them as you want
4将应用程序改成库文件module
In your library's gradle.build
, Change the line apply plugin: com.android.application
to apply plugin: com.android.library
and remove the setApplicationId