android studio编译报错

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:

  1. Prepare your library as a gradle Android library if your library's type is Eclipse ADT
    For this job it's enough to import it in Android Studio
  2. Copy your library folder, in this case MyLib folder, and paste it in your main project folder. It's a good practice to create a new folder in your main project folder and name it Libraries
  3. Go to Android Studio and open Settings.gradle file, there you should include your library in your main project. For example 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
  4. Open your Project Structure page(File->Project Structure...) click on modules then click on your main project go to dependencies tab click on + 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

同时还要去掉最小和最大minTaskId和maxtask Id,
以及下面的东西,会导致编译出错
 dexOptions {
        preDexLibraries = false
    }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值