首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AndroidStudio2.0打破ndk构建与分级-实验插件

AndroidStudio2.0打破ndk构建与分级-实验插件
EN

Stack Overflow用户
提问于 2016-04-09 10:58:52
回答 2查看 2.3K关注 0票数 3

在将Android更新到2.0版(稳定版)之后,我的项目的Gradle同步就中断了。

弹出错误:

代码语言:javascript
复制
Android Gradle Plugin Update Required

The project is using an incompatible version of the Android Gradle plugin.

To configure the project, the IDE will update the Android Gradle Plugin to version 2.0.0.

You can learn more about this version of the plugin from this [release notes][1].

-> Update   -> Cancel and update manually

分级同步问题(在messages视图中):

代码语言:javascript
复制
Error:The project is using an incompatible version of the Android Gradle plugin.
Please update your project to use version 2.0.0.
-> Search in build.gradle files

我按照推荐的方式使用梯度实验插件(classpath 'com.android.tools.build:gradle-experimental:0.6.0-alpha5')来构建ndk,例如这里,因此我的build.gradle看起来像这样(用com.android.model.application插件),我不能简单地‘更新’到classpath 'com.android.tools.build:gradle:2.0.0'

代码语言:javascript
复制
apply plugin: 'com.android.model.application'

def superpowered_path = file('.').absolutePath + "/src/main/jni/Superpowered"

model {

    repositories {
        libs(PrebuiltLibraries) {
            superpowered {
                headers.srcDir "${superpowered_path}"
                binaries.withType(StaticLibraryBinary) {
                    staticLibraryFile = file("${superpowered_path}/lib/${targetPlatform.getName()}/libSuperpoweredAndroid.a")
                }
            }
        }
    }

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.3"

        defaultConfig {
            applicationId "APPID"
            minSdkVersion.apiLevel 15
            targetSdkVersion.apiLevel 23
            versionCode 1
            versionName "1.0"

            archivesBaseName = "APPNAME-$versionCode-$versionName"

            renderscriptTargetApi 20
            renderscriptSupportModeEnabled true
        }

        buildTypes {
            release {
                minifyEnabled false
                proguardFiles.add(file('proguard-rules.pro'))
                signingConfig = $("android.signingConfigs.releaseSigning")
            }
            debug {
                applicationIdSuffix ".debug"
                versionNameSuffix "-DEBUG"
                signingConfig = $("android.signingConfigs.debugSigning")
            }
        }

        sources {
            main {
                jni {
                    dependencies {
                        library "superpowered" linkage "static"
                    }
                }
            }
        }

        /*
         * native build settings
         */
        ndk {
            moduleName = "NDKMODULE-jni"
            cppFlags.add("-std=c++11")
            ldLibs.addAll(["android", "log", "OpenSLES"])
            abiFilters.addAll(["armeabi-v7a", "x86", "arm64-v8a"])
        }
    }

    android.signingConfigs {
        create("releaseSigning") {
            keyAlias 'release'
            keyPassword 'PASSWORD'
            storeFile file('KEYSTORE.jks')
            storePassword 'PASSWORD'
            storeType "jks"
        }
        create("debugSigning") {
            keyAlias 'debug'
            keyPassword 'PASSWORD'
            storeFile file('KEYSTORE.jks')
            storePassword 'PASSWORD'
            storeType "jks"
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar', '*.a'])
    testCompile 'junit:junit:4.12'

    // Android support libs
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'
    compile 'com.android.support:support-v4:23.2.1'
    compile 'com.android.support:recyclerview-v7:23.2.1'

    // Android Async Http
    // Apache 2.0 http://loopj.com/android-async-http/
    compile 'com.loopj.android:android-async-http:1.4.9'

    // OkHttp http://square.github.io/okhttp/
    // Apache v2
    compile 'com.squareup.okhttp3:okhttp:3.2.0'

    // Picasso http://square.github.io/picasso/
    // Apache v2
    compile 'com.squareup.picasso:picasso:2.5.2'

    // Retrofit http://square.github.io/retrofit/
    // Apache v2
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
}

在AndroidStudio2.0的问题上,我所能找到的只是关于金丝雀/测试版的问题,并且似乎有着与这个不同的问题。在更新之前,Gradle同步正常工作。(我一直在使用上一个稳定版本,我认为是1.5.1?)

我希望有一些关于如何在AndroidStudio2.0中使用ndk的一些想法。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-04-09 11:24:15

使用分级-实验:0.7.0-alpha 1为我修复了等级同步:classpath 'com.android.tools.build:gradle-experimental:0.7.0-alpha1'

票数 2
EN

Stack Overflow用户

发布于 2016-08-10 11:52:30

使用下面的类路径解决了我的问题。

代码语言:javascript
复制
classpath 'com.android.tools.build:gradle-experimental:0.7.0'
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36515863

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档