Android NDK Integration: Error:Unable to load class BuildType$Impl
Android NDK Integration: Error:Unable to load class BuildType$Impl
我正在尝试将 NDK 集成到我的项目中。我正在使用 Gradle 包装器 2.9 和类路径:gradle-experimental:0.6.0-alpha3
。
项目级别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
}
应用级别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'
}
}
在构建应用程序时,我收到此错误:
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.
修改混淆器和产品风味的描述后,我收到此错误:
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.
尝试终止守护进程并重新运行构建
gradle --stop && gradle clean build
我遇到了完全相同的问题,解决方案是将 'dependencies' 放在模型 {} 之外。
我不知道这是否能解决您的问题,但它可能会导致出现问题。
尝试:
proguardFiles.add(文件("proguard-rules.txt"))
ndk.abiFilters.add("armeabi")
而不是 += 运算符。对列表聚合方法的支持很丰富,我发现 .add() 方法是最受支持的方法。
我正在尝试将 NDK 集成到我的项目中。我正在使用 Gradle 包装器 2.9 和类路径:gradle-experimental:0.6.0-alpha3
。
项目级别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
}
应用级别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'
}
}
在构建应用程序时,我收到此错误:
Error:Unable to load class 'com.android.build.gradle.managed.BuildType$Impl'. Possible causes for this unexpected error include:
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
- 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.
修改混淆器和产品风味的描述后,我收到此错误:
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.
尝试终止守护进程并重新运行构建
gradle --stop && gradle clean build
我遇到了完全相同的问题,解决方案是将 'dependencies' 放在模型 {} 之外。
我不知道这是否能解决您的问题,但它可能会导致出现问题。
尝试: proguardFiles.add(文件("proguard-rules.txt")) ndk.abiFilters.add("armeabi")
而不是 += 运算符。对列表聚合方法的支持很丰富,我发现 .add() 方法是最受支持的方法。