我已经在我的项目中激活了proguard,因为我试图在Google Play上发布它.即使proguard-android.txt有
-keepclassmembers class **.R$* {
public static <fields>;
Run Code Online (Sandbox Code Playgroud)
}
这意味着它不应该混淆我需要的R.raw类,我发现在运行这段代码时
import headwayEnt.Blackhole_Darksun.R;
private static final String RES_PATH = "headwayEnt.Blackhole_Darksun.R";
public static int getFileHandle(String fileName, String path) {
String fullPath = RES_PATH + '$' + path;
if (subClass == null) {
Class<headwayEnt.Blackhole_Darksun.R> c = null;
try {
c = (Class<R>)Class.forName(RES_PATH);
} catch(ClassNotFoundException e) {
e.printStackTrace();
} catch(ClassCastException e) {
e.printStackTrace();
}
subClass = c.getDeclaredClasses();
}
int fileHandle = 0;
try {
int i = 0;
System.out.println("fullPath: " + fullPath + …
Run Code Online (Sandbox Code Playgroud) 如果我有一个应用程序的build.gradle:
android {
compileSdkVersion 24
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.ndkcmaketest.headwayent.ndkcmaketest"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions"
arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=gcc"//, "-DANDROID_ALLOW_UNDEFINED_SYMBOLS=TRUE"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
Run Code Online (Sandbox Code Playgroud)
如何将cpufeatures添加为ldlibs?在externalNativeBuild中添加ldLibs.addAll(["cpufeatures"])不起作用.并且都没有添加ndk块.
android cmake android-ndk build.gradle android-gradle-plugin