Android Gradle 项目出现的问题:
2、gradle编译方式不一样
3、gradle 工具不一样
runProguard函数已经被废弃并且停止使用了
改成minifyEnabled
即如下的配置
buildTypes { release { minifyEnabled false // 替代的方式 ...... } }
runProguard —> minifyEnabled
jniDebuggBuild –> jniDebuggable
zipAlign –> zipAlignEnabled
2,Library projects cannot set applicationId
新版本不能使用applicationId来定义库module的包名了,要定义在manifest
defaultConfig { applicationId "cn.flakor.lib" <---- 删除这行 minSdkVersion 15 targetSdkVersion 19 versionCode 1 versionName "1.0" }
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="cn.flakor.lib">
...
利用flavor重命名包名
android { ... productFlavors { flavor1 { applicationId 'cn.flakor.newname' } }
apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion '22.0.1' defaultConfig { applicationId 'dean.demo' minSdkVersion 21 targetSdkVersion 21 versionCode 1 versionName '1.0'
} buildTypes { release { apply plugin: 'announce' minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:recyclerview-v7:21.+' compile 'com.android.support:cardview-v7:21.+' }
compileSdkVersion 22 buildToolsVersion '22.0.1'