imobile-maio / maio-Android-SDK

5 stars 3 forks source link

Workaround for Android P #15

Closed S64 closed 6 years ago

S64 commented 6 years ago

背景

Android 9を搭載した端末で利用したところ、広告の取得ができずmaioを利用できませんでした。 ログを確認したところ、 maio内部実装にApache HTTP Clientクラスの利用を試みていると見受けられる箇所にて例外が発生しておりました。

10-02 11:57:01.174 10624 10644 I .android.sampl: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.ResponseHandler" on path: DexPathList[[zip file "/data/app/jp.maio.sdk.android.sample-ivM-Ag9zBJZ1JJi7BbTScg==/base.apk"],nativeLibraryDirectories=[/data/app/jp.maio.sdk.android.sample-ivM-Ag9zBJZ1JJi7BbTScg==/lib/arm64, /system/lib64]]
10-02 11:57:01.174 10624 10644 I .android.sampl:   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at void jp.maio.sdk.android.bj.a(android.content.Context) ((null):-1)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.a(android.app.Activity, jp.maio.sdk.android.MaioAdsListenerInterface, java.lang.String) ((null):-1)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.b(android.app.Activity, java.lang.String, jp.maio.sdk.android.MaioAdsListenerInterface) ((null):-1)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.a(jp.maio.sdk.android.MaioAds, android.app.Activity, java.lang.String, jp.maio.sdk.android.MaioAdsListenerInterface) ((null):-1)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at void jp.maio.sdk.android.MaioAds$1.run() ((null):-1)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1167)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:641)
10-02 11:57:01.174 10624 10644 I .android.sampl:   at void java.lang.Thread.run() (Thread.java:764)
10-02 11:57:01.174 10624 10644 I .android.sampl: 
10-02 11:57:01.186 10624 10648 I .android.sampl: Rejecting re-init on previously-failed class java.lang.Class<jp.maio.sdk.android.bj$1>: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/client/ResponseHandler;
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.bj.a(android.content.Context) ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.a(android.app.Activity, jp.maio.sdk.android.MaioAdsListenerInterface, java.lang.String) ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.b(android.app.Activity, java.lang.String, jp.maio.sdk.android.MaioAdsListenerInterface) ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.a(jp.maio.sdk.android.MaioAds, android.app.Activity, java.lang.String, jp.maio.sdk.android.MaioAdsListenerInterface) ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.MaioAds$1.run() ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1167)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:641)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void java.lang.Thread.run() (Thread.java:764)
10-02 11:57:01.186 10624 10648 I .android.sampl: Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.ResponseHandler" on path: DexPathList[[zip file "/data/app/jp.maio.sdk.android.sample-ivM-Ag9zBJZ1JJi7BbTScg==/base.apk"],nativeLibraryDirectories=[/data/app/jp.maio.sdk.android.sample-ivM-Ag9zBJZ1JJi7BbTScg==/lib/arm64, /system/lib64]]
10-02 11:57:01.186 10624 10648 I .android.sampl:   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.bj.a(android.content.Context) ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.a(android.app.Activity, jp.maio.sdk.android.MaioAdsListenerInterface, java.lang.String) ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.b(android.app.Activity, java.lang.String, jp.maio.sdk.android.MaioAdsListenerInterface) ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.MaioAds.a(jp.maio.sdk.android.MaioAds, android.app.Activity, java.lang.String, jp.maio.sdk.android.MaioAdsListenerInterface) ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void jp.maio.sdk.android.MaioAds$1.run() ((null):-1)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1167)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:641)
10-02 11:57:01.186 10624 10648 I .android.sampl:   at void java.lang.Thread.run() (Thread.java:764)

対処

maio SDK本体から既に非推奨となっているApache HTTP Clientを削除することは私からは不可能でしたので、取り急ぎの対応として bootclasspath にApache HTTP Clientを追加するよう明示しました。 また現状では各アプリパブリッシャが個別に対応する必要がございますので、READMEにもその旨を明記しました。

ご確認下さい。

im-ade commented 6 years ago

@S64 Thank you I will take a look at it!

im-ade commented 6 years ago

@S64 we are planning to release 1.1.5 this week or next week which will replace HttpClient with HttpUrlConnection. However, for versions 1.1.4 and below the problem will not be fixed. So I will add your changes and write that they apply to versions 1.1.4 and below!

Thank you very much for your contribution!