Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tencent.stat.StatConfig" 问题解决 #10

Open
litang0908 opened this issue Jul 30, 2019 · 2 comments

Comments

@litang0908
Copy link
Contributor

litang0908 commented Jul 30, 2019

机型:Android 9
现象:调用QQ登录时,直接闪退

抱歉,遇到了这个问题,见没有人回答,自己解决后,就一起贴上来了,Log日志如下(删减了中间部分)

W/System.err(25626): java.lang.ClassNotFoundException: com.tencent.stat.StatConfig
W/System.err(25626): 	at java.lang.Class.classForName(Native Method)
W/System.err(25626): 	at java.lang.Class.forName(Class.java:453)
W/System.err(25626): 	at java.lang.Class.forName(Class.java:378)
W/System.err(25626): 	at com.tencent.connect.a.a.c(ProGuard:58)
W/System.err(25626): 	at com.tencent.connect.auth.c.<init>(ProGuard:43)
W/System.err(25626): 	at com.tencent.connect.auth.c.a(ProGuard:92)
W/System.err(25626): 	at com.tencent.tauth.Tencent.<init>(ProGuard:59)
W/System.err(25626): 	at com.tencent.tauth.Tencent.createInstance(ProGuard:67)
W/System.err(25626): 	at com.github.marekchen.flutterqq.FlutterQqPlugin.registerQQ(FlutterQqPlugin.java:84)
W/System.err(25626): 	at com.github.marekchen.flutterqq.FlutterQqPlugin.onMethodCall(FlutterQqPlugin.java:59)
W/System.err(25626): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
W/System.err(25626): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
W/System.err(25626): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:644)
W/System.err(25626): 	at android.os.MessageQueue.nativePollOnce(Native Method)
W/System.err(25626): 	at android.os.MessageQueue.next(MessageQueue.java:386)
W/System.err(25626): 	at android.os.Looper.loop(Looper.java:169)
W/System.err(25626): 	at android.app.ActivityThread.main(ActivityThread.java:7470)
W/System.err(25626): 	at java.lang.reflect.Method.invoke(Native Method)
W/System.err(25626): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
W/System.err(25626): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
W/System.err(25626): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tencent.stat.StatConfig" on path: DexPathList[[zip file "/data/app/com.mutangtech.qianji.fltand-eCKrztS9dAeMZjOgsv4tZg==/base.apk"],nativeLibraryDirectories=[/data/app/com.mutangtech.qianji.fltand-eCKrztS9dAeMZjOgsv4tZg==/lib/arm64, /data/app/com.mutangtech.qianji.fltand-eCKrztS9dAeMZjOgsv4tZg==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]
W/System.err(25626): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
W/System.err(25626): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
W/System.err(25626): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
W/System.err(25626): 	... 20 more
I/openSDK_LOG.QQAuth(25626): new QQAuth() --end
I/openSDK_LOG.QQAuth(25626): QQAuth -- createInstance()  --end
I/openSDK_LOG.Tencent(25626): createInstance()  -- end
I/openSDK_LOG.Tencent(25626): login() with activity, scope is get_simple_userinfo
I/openSDK_LOG.QQAuth(25626): login()
I/openSDK_LOG.QQAuth(25626): -->login activity: com.mutangtech.qianji.fltand.host.MainActivity@edf7914
E/AndroidRuntime(25626): FATAL EXCEPTION: Thread-4
E/AndroidRuntime(25626): Process: com.mutangtech.qianji.fltand, PID: 25626
E/AndroidRuntime(25626): java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/conn/scheme/SchemeRegistry;
E/AndroidRuntime(25626): 	at com.tencent.open.utils.HttpUtils.getHttpClient(ProGuard:626)
E/AndroidRuntime(25626): 	at com.tencent.open.utils.HttpUtils.openUrl2(ProGuard:506)
E/AndroidRuntime(25626): 	at com.tencent.open.utils.f$1.run(ProGuard:197)
E/AndroidRuntime(25626): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.conn.scheme.SchemeRegistry" on path: DexPathList[[zip file "/data/app/com.mutangtech.qianji.fltand-eCKrztS9dAeMZjOgsv4tZg==/base.apk"],nativeLibraryDirectories=[/data/app/com.mutangtech.qianji.fltand-eCKrztS9dAeMZjOgsv4tZg==/lib/arm64, /data/app/com.mutangtech.qianji.fltand-eCKrztS9dAeMZjOgsv4tZg==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]
E/AndroidRuntime(25626): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime(25626): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(25626): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

@litang0908
Copy link
Contributor Author

原因
其实并不是 java.lang.ClassNotFoundException: com.tencent.stat.StatConfig 导致的,而是自从Android P 开始,没有 org.apache.http 这个library导致的。

解决方案:
在AndroidManifest.xml 的 application 节点下面,增加这一行代码即可:

<uses-library
            android:name="org.apache.http.legacy"
            android:required="false" />

自问自答了,希望对大家有用

@hzp1993
Copy link

hzp1993 commented Apr 15, 2020

原因
其实并不是 java.lang.ClassNotFoundException: com.tencent.stat.StatConfig 导致的,而是自从Android P 开始,没有 org.apache.http 这个library导致的。

解决方案:
在AndroidManifest.xml 的 application 节点下面,增加这一行代码即可:

<uses-library
            android:name="org.apache.http.legacy"
            android:required="false" />

自问自答了,希望对大家有用

非常感谢 解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants