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

Many apps crash at launch, some not. #26

Closed
incyclum opened this issue Jun 10, 2016 · 4 comments
Closed

Many apps crash at launch, some not. #26

incyclum opened this issue Jun 10, 2016 · 4 comments

Comments

@incyclum
Copy link

incyclum commented Jun 10, 2016

Hi,

Many apps crash at launch like Snapchat or GIPHY.

In the Xposed logs I found the common error :

Inspeckage_Error com.android.okhttp.OkHttpClient#open(java.net.URI)#exact
Inspeckage_Error java.lang.ClassNotFoundException: com.android.okhttp.internal.http.HttpURLConnectionImpl
Inspeckage_FileSystem:R/W Dir: [...]

Using OnePlus X - Custom CM13.0 ROM - Xposed v85, Inspeckage 1.4.

Own build of Inspeckage beacause otherwise Xposed says it can't load module
beacause you have to disable Instant Run in Android Studio. So I rebuilt the APK
after disabling Instant Run in the IDE settings. No changes in graddle configuration.

Thanks for your help.

@ac-pm
Copy link
Owner

ac-pm commented Jun 10, 2016

Hi @incyclum I will check the problem. Thankyou.

@incyclum
Copy link
Author

incyclum commented Jun 10, 2016

I found only 3 usages of the class com.android.okhttp.internal.http.HttpURLConnectionImpl, in the file HttpHook.java:

(149-67) - final Class<?> httpURLConnectionImpl = findClass("com.android.okhttp.internal.http.HttpURLConnectionImpl", loadPackageParam.classLoader);
(151-40) - findAndHookMethod("com.android.okhttp.internal.http.HttpURLConnectionImpl", loadPackageParam.classLoader, "getOutputStream", RequestHook);
(152-40) - findAndHookMethod("com.android.okhttp.internal.http.HttpURLConnectionImpl", loadPackageParam.classLoader, "getInputStream", ResponseHook);
try {
            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
                findAndHookMethod("libcore.net.http.HttpURLConnectionImpl", loadPackageParam.classLoader, "getOutputStream", RequestHook);
            } else {
                //com.squareup.okhttp.internal.http.HttpURLConnectionImpl
                final Class<?> httpURLConnectionImpl = findClass("com.android.okhttp.internal.http.HttpURLConnectionImpl", loadPackageParam.classLoader);
                if(httpURLConnectionImpl != null) {
                    findAndHookMethod("com.android.okhttp.internal.http.HttpURLConnectionImpl", loadPackageParam.classLoader, "getOutputStream", RequestHook);
                    findAndHookMethod("com.android.okhttp.internal.http.HttpURLConnectionImpl", loadPackageParam.classLoader, "getInputStream", ResponseHook);
                }
            }
        } catch (Error e){
            Module.logError(e);
        }

Two Xposed helpers related to class loading are referenced in the api doc:

@incyclum
Copy link
Author

incyclum commented Jun 10, 2016

  • Apps are not crashing when the module is disabled.
  • Problem 1 XposedHelpers.ClassNotFoundError throwed by findClass at line 149
  • Problem 2 findAndHookMethod(okHttpClient, "open"... line 129 : the open method doesn't exists since OkHttp 2.x, see https://stackoverflow.com/questions/33311409/okhttpclient-open-method-missing-in-v2-0
  • Problem 1 fixed : Replacing com.android.okhttp.internal.http.HttpURLConnectionImpl by com.android.okhttp.internal.huc.HttpURLConnectionImpl in findClass fixed the catch error.
  • Problem 2 fixed : I commented out the findAndHookMethod block because I don't know what to do to fix it properly.

Still crashing

I don't what to do next... keep diggin'

@incyclum
Copy link
Author

incyclum commented Jun 10, 2016

Placed some XposedBridge.log at some points of the code.
It tells me that all _Foo_Hook.initAllHooks in the Module class executed without anymore log
message.

Had a JNI ERROR in the Xposed logs messages and Google-ed : http://forum.xda-developers.com/xposed/lollipop-module-crashes-art-jni-error-t3030586

Removed usage of FileSystemHook class and no more crash. but still crashing with other apps.

Going to bed now.
Need to clean up all those debug log messages.

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