Android 开机自启动App功能,找不到.so文件的问题

先简单说一下开机自启动app的方式:

step1:manifest文件中加入权限

uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"

setp2:静态方式创建广播,来接收系统开机广播。这就补贴代码了 ,我贴onReceive里具体实现方法:

Log.i("broadCastReceiver","onReceiver...");

Intent mBootIntent =new Intent(context, MainActivity.class);

// 必须设置FLAG_ACTIVITY_NEW_TASK

mBootIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

context.startActivity(mBootIntent);

正常情况这样就可以达到开机自启动app的效果 。

可是我的项目中配置完成后,开机始终提示

java.lang.ClassNotFoundException: Didn't find class "XXX" on path:

DexPathList[[zip file "/data/app/com.chemao.certification-2/base.apk"],

nativeLibraryDirectories=[/data/app/com.chemao.certification-2/lib/arm, /vendor/lib, /system/lib]]   

这样的错误,找不到?? wfc??

各种百度,google都没找到解决方法。

后来仔细看了一遍我的manifest文件,突然意识到 我之前在app下的gradle中改了app的 applicationId 导致报名和manifest中的报名不一致。

经过调整后运行OK了。问题解决!!!

自己真的也是太粗心了。

总结一下,如遇到

java.lang.ClassNotFoundException: Didn't find class "XXX" on path:

DexPathList[[zip file "/data/app/com.chemao.certification-2/base.apk"]

这种问题应该都是这个原因导致的 。

你可能感兴趣的:(Android 开机自启动App功能,找不到.so文件的问题)