我有一个奇怪的问题,我知道这是以前写的,但所有的解决方案都不起作用:(
错误:执行任务':app:transformNative_libsWithStripDebugSymbolForDebug'失败。
. lang。NullPointerException(无错误信息)
在gradle 2.2之前调试
我有一个星期没有任何解决方案:(
——项目级——build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.8.1'
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
——应用程序级——
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 24
buildToolsVersion = '24.0.3'
defaultConfig {
applicationId = 'com.czar.tunnel.cave'
minSdkVersion.apiLevel = 12
targetSdkVersion.apiLevel = 24
versionCode = 7
versionName = '7.0'
}
ndk {
platformVersion = 12
moduleName = 'game'
toolchain = 'clang'
stl = 'gnustl_static' // recommending gnustl_static/gnustl_shared for android
cppFlags.addAll(['-std=c++11', '-Wall', // glm could not take -Wall -Werror
'-D GLM_FORCE_SIZE_T_LENGTH', '-D GLM_FORCE_RADIANS',
'-I' + file('src/main/jni'),
'-I' + file('src/main/jni/data')])
ldLibs.addAll(['android', 'EGL', 'GLESv2', 'OpenSLES', 'log'])
}
sources {
main {
jni {
dependencies {
project ':nativeactivity' linkage 'static'
}
}
}
}
buildTypes {
release {
minifyEnabled = false
}
}
}
android.lintOptions {
abortOnError = false
}
}
dependencies {
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.1'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
——模块级——build.gradle
----原生活动gradle----
apply plugin: 'com.android.model.library'
def ndkDir = System.getenv("ANDROID_NDK_HOME")
def propertiesFile = project.rootProject.file('local.properties')
if (propertiesFile.exists()) {
Properties properties = new Properties()
properties.load(propertiesFile.newDataInputStream())
ndkDir = properties.getProperty('ndk.dir')
}
model {
android {
compileSdkVersion = 24
buildToolsVersion = '24.0.3'
defaultConfig.with {
minSdkVersion.apiLevel = 12
targetSdkVersion.apiLevel = 24
versionCode = 1
versionName = '0.0.1'
}
ndk {
moduleName = 'native-activity'
ldLibs.addAll(['log', 'android'])
ldFlags.add('-c')
}
sources {
main {
jni {
source {
srcDir "${ndkDir}/sources/android/native_app_glue"
}
exportedHeaders {
srcDir "${ndkDir}/sources/android/native_app_glue"
}
}
}
}
}
}
dependencies {
compile 'com.google.android.gms:play-services-ads-lite:9.4.0'
}
尝试将classpath 'com.android.tools.build:gradle:2.2.1'更改为Classpath 'com.android.tools.build:gradle:1.5.0'