Android的NDK集成:错误:无法加载类BuildType $默认地将Impl [英] Android NDK Integration: Error:Unable to load class BuildType$Impl

查看:2185
本文介绍了Android的NDK集成:错误:无法加载类BuildType $默认地将Impl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图NDK融入我的项目。我使用的包装器摇篮2.9和CLASSPATH: gradle这个实验性:0.6.0-素α3

项目的gradle级:

  buildscript {
    库{
        jcenter()
    }
    依赖{
        类路径'com.android.tools.build:gradle-experimental:0.6.0-alpha6
      }
}allprojects {
    库{
        jcenter()
    }
}任务清除(类型:删除){
    删除rootProject.buildDir
}

应用程序的gradle级:

 应用插件:'com.android.model.application模型{
    安卓{
        compileSdkVersion = 23
        buildToolsVersion =23.0.2        defaultConfig.with {
            的applicationID =com.ms.knowursensor.android
            minSdkVersion.apiLevel = 11
            targetSdkVersion.apiLevel = 23
        }
    }    compileOptions.with {
        sourceCompatibility = JavaVersion.VERSION_1_7
        targetCompatibility = JavaVersion.VERSION_1_7
    }    android.ndk {
        MODULENAME =sensorgraph
    }
    android.buildTypes {
        发布 {
            minifyEnabled = FALSE
            proguardFiles + =文件(ProGuard的-rules.txt')
        }
    }
    android.productFlavors {
        创建(ARM){
            ndk.abiFilters + =armeabi
        }
        创建(ARM7){
            ndk.abiFilters + =armeabi-V7A
        }
        创建(ARM8){
            ndk.abiFilters + =arm64-V8A
        }
        创建(86){
            ndk.abiFilters + =86
        }
        创建(X86-64){
            ndk.abiFilters + =x86_64的
        }
        创建(MIPS){
            ndk.abiFilters + =MIPS
        }
        创建(MIPS-64){
            ndk.abiFilters + =MIPS64
        }
        创建(全能)
    }     依赖{
        编译文件树(导演:'库',包括:['的* .jar'])
        编译com.android.support:appcompat-v7:23.1.1
        编译com.android.support:support-v4:23.1.1
        编译com.android.support:design:23.1.1
        编译com.android.support:cardview-v7:23.1.1
        编译com.android.support:recyclerview-v7:23.1.1
    }
}

在构建应用程序,我收到此错误:


  

错误:无法加载类
  com.android.build.gradle.managed.BuildType $默认地将Impl'。可能的原因
  这个意外的错误包括:

  • 摇篮的依赖缓存可能
      腐败(这是一个网络连接超时后,有时会出现。)重新下载的依赖和同步工程(需要
      网)
  • 一个摇篮建设进程(守护进程)的状态可能
      损坏。停止所有摇篮守护进程可能会解决这个问题。停止摇篮构建过程(需要
      重启)
  • 您的项目可能会使用第三方插件
      这是不符合的项目或其他兼容的插件
      摇篮的版本所要求的项目。
在的情况下,
  腐败的摇篮过程中,你也可以尝试关闭IDE,然后
  杀死所有Java进程。


修改ProGuard,并将其产品风味我收到此错误的描述之后:

 错误:发生了配置工程:应用程序。
>下面的模型规则不能适用于因未绑定的输入和/或科目:
    compileOptions.with {...} @应用程序\\的build.gradle线15条,第5列
      学科:
         - compileOptions.with对象[*]
    依赖{...} @应用程序\\的build.gradle 68行,第6列
      学科:
         - 依赖的对象[*]
  [*] - 表示一个模型项不能用于路径或类型中找到。


解决方案

我有完全一样的问题,而解决方案是把'依赖'的模式{}

之外

I am trying to integrate NDK into my project. I am using Gradle wrapper 2.9 and classpath:gradle-experimental:0.6.0-alpha3.

Project level gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle-experimental:0.6.0-alpha6'
      }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App level gradle:

apply plugin: 'com.android.model.application'

model {
    android {
        compileSdkVersion = 23
        buildToolsVersion = "23.0.2"

        defaultConfig.with {
            applicationId = "com.ms.knowursensor.android"
            minSdkVersion.apiLevel = 11
            targetSdkVersion.apiLevel = 23
        }
    }

    compileOptions.with {
        sourceCompatibility=JavaVersion.VERSION_1_7
        targetCompatibility=JavaVersion.VERSION_1_7
    }

    android.ndk {
        moduleName = "sensorgraph"
    }
    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles  += file('proguard-rules.txt')
        }
    }
    android.productFlavors {
        create("arm") {
            ndk.abiFilters += "armeabi"
        }
        create("arm7") {
            ndk.abiFilters += "armeabi-v7a"
        }
        create("arm8") {
            ndk.abiFilters += "arm64-v8a"
        }
        create("x86") {
            ndk.abiFilters += "x86"
        }
        create("x86-64") {
            ndk.abiFilters += "x86_64"
        }
        create("mips") {
            ndk.abiFilters += "mips"
        }
        create("mips-64") {
            ndk.abiFilters += "mips64"
        }
        create("all")
    }

     dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:23.1.1'
        compile 'com.android.support:support-v4:23.1.1'
        compile 'com.android.support:design:23.1.1'
        compile 'com.android.support:cardview-v7:23.1.1'
        compile 'com.android.support:recyclerview-v7:23.1.1'
    }
}

On building app, i receive this error:

Error:Unable to load class 'com.android.build.gradle.managed.BuildType$Impl'. Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

After modifying description of proguard and product flavor i am receiving this error:

Error:A problem occurred configuring project ':app'.
> The following model rules could not be applied due to unbound inputs and/or subjects:
    compileOptions.with { ... } @ app\build.gradle line 15, column 5
      subject:
        - compileOptions.with Object [*]
    dependencies { ... } @ app\build.gradle line 68, column 6
      subject:
        - dependencies Object [*]
  [*] - indicates that a model item could not be found for the path or type.

解决方案

I had exactly the same problem, and the solution was putting 'dependencies' outside the model {}.

这篇关于Android的NDK集成:错误:无法加载类BuildType $默认地将Impl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆