安卓开发,打包时是不是不能加混淆?

0 投票
最新提问 6月 28, 2018 用户: langlangsd (160 分)
修改于 6月 29, 2018 用户:langlangsd

引入了安卓sdk,

打包时是不是不能加混淆?

加入混淆时报错:

06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: fid == null
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]     in call to GetLongField
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]     from boolean cn.easyar.CameraFrameStreamer.attachCamera(cn.easyar.CameraDevice)
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x75242fa8 self=0x5584746330
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   | sysTid=26900 nice=0 cgrp=default sched=0/0 handle=0x7f9cab5e80
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   | state=R schedstat=( 766704442 85943590 1176 ) utm=68 stm=8 core=6 HZ=100
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   | stack=0x7ff1c19000-0x7ff1c1b000 stackSize=8MB
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   native: #00 pc 00003ae4  /system/lib64/libbacktrace_libc++.so (_ZN9Backtrace6UnwindEmP8ucontext+28)
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   native: #01 pc 0000001c  ???
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   at cn.easyar.CameraFrameStreamer.attachCamera(Native method)
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   at com.langlang.preschool.activity.ar.HelloAR.initialize(unavailable:-1)
06-28 17:42:20.405 26900-26900/? A/art: art/runtime/check_jni.cc:65]   at com.langlang.preschool.activity.ar.GLView.onAttachedToWindow(unavailable:-1)

看官方demo中build.gradle中配置:

release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

是不启用混淆的。

----------------------------------------------

混淆中已加入代码:

-keep class com.easyar.** {*;}

-----------------------------------------
所以是不是不能加混淆????

------------------------------------------

29日再次测试报错如下:

 JNI DETECTED ERROR IN APPLICATION: JNI GetLongField called with pending exception 'java.lang.NoSuchFieldError' thrown in boolean cn.easyar.CameraFrameStreamer.attachCamera(cn.easyar.CameraDevice):-2

1个回答

0 投票
最新回答 9月 10, 2018 用户: learder (140 分)
加上这个

-keep class cn.easyar.** {*;}
欢迎来到 EasyAR Q&A ,有什么不懂的可以尽管在这里提问,你将会收到社区其他成员的回答。
...