xu-li / cordova-plugin-wechat

A cordova plugin, a JS version of Wechat SDK
1.22k stars 508 forks source link

「求助,真的无能为力了」返回时app重启 ,报错已截图 #490

Closed Nocturne-FFG closed 5 years ago

Nocturne-FFG commented 5 years ago

git上所有方法都试了,无解了。。。。 华为mt7 无论怎么样他都是重启 用as看了错误: 01-20 14:26:28.916 16803-16803/? E/MtaSDK: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.jueyn.client/com.jueyn.client.wxapi.WXPayEntryActivity}: java.lang.ClassNotFoundException: Didn't find class "com.jueyn.client.wxapi.WXPayEntryActivity" on path: DexPathList[[zip file "/data/app/com.jueyn.client-1/base.apk"],nativeLibraryDirectories=[/data/app/com.jueyn.client-1/lib/arm, /data/app/com.jueyn.client-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2352) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504) at android.app.ActivityThread.access$900(ActivityThread.java:165) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:150) at android.app.ActivityThread.main(ActivityThread.java:5546) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.jueyn.client.wxapi.WXPayEntryActivity" on path: DexPathList[[zip file "/data/app/com.jueyn.client-1/base.apk"],nativeLibraryDirectories=[/data/app/com.jueyn.client-1/lib/arm, /data/app/com.jueyn.client-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.app.Instrumentation.newActivity(Instrumentation.java:1070) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2342) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504)  at android.app.ActivityThread.access$900(ActivityThread.java:165)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:150)  at android.app.ActivityThread.main(ActivityThread.java:5546)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)  Suppressed: java.lang.ClassNotFoundException: com.jueyn.client.wxapi.WXPayEntryActivity at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)

Nocturne-FFG commented 5 years ago

错误中说到了了.wxapi.WXPayEntryActivity这个东西,但是git上 说修改targetDir的方法我也试了 还是不行

jasonz1987 commented 5 years ago

@Nocturne-FFG 请告诉我使用的插件版本 以及cordova版本, 以及platforms/android下的目录。

Nocturne-FFG commented 5 years ago

升级版本好了已经...... 之前因为2.1以上版本一直编译报错,所以没有升级,没想到插件现在有人维护又有新版本了! 另外就是我升级后安卓上一直报参数格式错误,不管我用以前的参数格式还是现在文档的参数格式都会,后来我加了个appid的参数就好了

jasonz1987 commented 5 years ago

@Nocturne-FFG 嗯 最新版本修复了cordova-android7的问题,你说的参数格式错误是什么问题呢?

576667737 commented 5 years ago

你好 请问一下ionic3使用该插件, 分享后返回APP时候出现APP重启要怎么解决呢,检查过包名和MD5签名都没问题 cordova 版本8.0.0 android版本7.0.0

cpw999cn commented 5 years ago

自己摸索找到了问题,看看能不能帮到你们 1、在项目 plugin/cordova-plugin-wechat/scripts/android-install.js 第43行,将targetDir改为: var targetDir = path.join(projectRoot, "platforms", "android", "app", "src", "main", "java", packageName.replace(/./g, path.sep), "wxapi"); 2、移除已生成的安卓工程:ionic cordova platform rm android 3、重新生成安卓工程:ionic cordova platform add android