Gradle迁移新版本的问题

1,Gradle DSL method not found: ‘runProguard()’

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'
       }
   }

参考(不f 看不了,有时间翻译下):

http://tools.android.com/tech-docs/new-build-system/user-guide

http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0

 

Add the following values to build.gradle for android gradle plugin v0.14+

android {
    ...
    defaultConfig {
        ...
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
    }
    ...
}

For older versions of the android gradle plugin v0.13.3 and below

android {
        ...
        defaultConfig {
            ...
            renderscriptTargetApi 19
            renderscriptSupportMode true
        }
        ...
    }

Once that is done, use android.support.v8.renderscript. anywhere in your app. The library jar and binaries are included automatically.

猜你喜欢

转载自spirals.iteye.com/blog/2205618