android-hacker / VirtualXposed

A simple app to use Xposed without root, unlock the bootloader or modify system image, etc.
https://vxp.app
GNU General Public License v3.0
15.44k stars 2.49k forks source link

点击网易新闻闪退 报expected to find a valid ContentProvider for this authority #780

Open amoxicillin opened 4 years ago

amoxicillin commented 4 years ago

反馈BUG之前,先issue里面搜看看有没有别人已经反馈过,重复的不予处理!!

问题描述

点击“网易新闻”主界面右下角的“我的”按钮,会闪退回桌面

复现步骤

在vx内安装网易新闻app,启动网易新闻app,点击主界面右下角的“我的”按钮,即出现闪退

环境

机型:三星S8 系统版本:9.0 ROM版本:官方9.0最新版 Xposed 插件以及插件版本:未安装任何xp插件 VirtualXposed版本:0.18.0

补充

根据闪退时logcat的信息来看,都集中于 java.lang.SecurityException: Failed to find provider com.netease.newsreader for user 0; expected to find a valid ContentProvider for this authority

附上logcat信息:

12-09 19:12:31.687 15487 15487 D AndroidRuntime: Shutting down VM 12-09 19:12:31.690 15487 15487 E AndroidRuntime: FATAL EXCEPTION: main 12-09 19:12:31.690 15487 15487 E AndroidRuntime: Process: com.netease.newsreader.activity, PID: 15487 12-09 19:12:31.690 15487 15487 E AndroidRuntime: java.lang.SecurityException: Failed to find provider com.netease.newsreader for user 0; expected to find a valid ContentProvider for this authority 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:1966) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1934) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1884) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.content.IContentService$Stub$Proxy.registerContentObserver(IContentService.java:799) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.lody.virtual.client.hook.base.MethodInvocationStub$HookInvocationHandler.invoke(MethodInvocationStub.java:189) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at java.lang.reflect.Proxy.invoke(Proxy.java:1006) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at $Proxy23.registerContentObserver(Unknown Source) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1979) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1968) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.fb.a(MilkPCPresenter.java:135) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.gv.run(MilkPCPresenter.java:1) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.s.a(PatchWeaveUtils.java:66) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.f(AspectSpecControler.java:211) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.b(AspectSpecControler.java:89) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.fb.b(MilkPCPresenter.java:132) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.hf.run(MilkPCPresenter.java:1) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.s.a(PatchWeaveUtils.java:66) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.f(AspectSpecControler.java:211) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.a(AspectSpecControler.java:67) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.fb.b(MilkPCPresenter.java:132) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.MilkMainPersonCenterFragment.a(MilkMainPersonCenterFragment.java:124) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.ba.run(MilkMainPersonCenterFragment.java:1) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.s.a(PatchWeaveUtils.java:66) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.f(AspectSpecControler.java:211) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.b(AspectSpecControler.java:89) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.MilkMainPersonCenterFragment.b(MilkMainPersonCenterFragment.java:122) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.ch.run(MilkMainPersonCenterFragment.java:1) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.s.a(PatchWeaveUtils.java:66) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.f(AspectSpecControler.java:211) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.a(AspectSpecControler.java:67) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.nr.phone.main.pc.MilkMainPersonCenterFragment.onCreate(MilkMainPersonCenterFragment.java:122) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.Fragment.performCreate(Fragment.java:2246) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1377) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1187) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.FragmentTransition.calculateFragments(FragmentTransition.java:1070) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:115) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2374) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:781) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.newsreader.common.utils.a.d.b(FragmentTabManager.java:129) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.newsreader.common.utils.a.i.run(FragmentTabManager.java:1) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.s.a(PatchWeaveUtils.java:66) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.f(AspectSpecControler.java:211) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.patch.b.a(AspectSpecControler.java:67) 12-09 19:12:31.690 15487 15487 E AndroidRuntime: at com.netease.newsreader.common.utils.a.d.onTabChanged(FragmentTabManager.java:88) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.widget.TabHost.invokeOnTabChangeListener(TabHost.java:461) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.widget.TabHost.setCurrentTab(TabHost.java:446) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at com.netease.cm.ui.tabhost.NTTabHost$1.a(NTTabHost.java:41) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at com.netease.cm.ui.tabhost.NTTabWidget$b.onClick(NTTabWidget.java:42) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.view.View.performClick(View.java:7352) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.view.View.performClickInternal(View.java:7318) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.view.View.access$3200(View.java:846) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.view.View$PerformClick.run(View.java:27801) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:873) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7045) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace: 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at com.android.server.content.ContentService.registerContentObserver(ContentService.java:368) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.content.IContentService$Stub.onTransact(IContentService.java:76) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at com.android.server.content.ContentService.onTransact(ContentService.java:278) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: at android.os.Binder.execTransact(Binder.java:739) 12-09 19:12:31.691 15487 15487 E AndroidRuntime: 12-09 19:12:31.694 15487 15487 I afecontainer:p: System.exit called, status: 0 12-09 19:12:31.695 15487 15487 I AndroidRuntime: VM exiting with result code 0, cleanup skipped.

写完之后,请自己再读一遍自己写的,如果你自己都读不懂,就不用说修复了

kiwi-bo commented 4 years ago

我也遇到了这个问题,下载最新版本的网易新闻,选择从磁盘安装应用,启动就会出现这个问题,暂时没有找到解决方案,

kiwi-bo commented 4 years ago

lib\src\main\java\com\lody\virtual\client\hook\proxies\content\MethodProxies.java用于对contentService服务的函数进行hook, 针对以上问题,和notifyChange是同样的处理方式, registerContentObserver函数中,也有以下的检测代码: if (targetSdkVersion >= Build.VERSION_CODES.O) { throw new SecurityException(msg); } else { if (msg.startsWith("Failed to find provider")) { // Sigh, we need to quietly let apps targeting older API // levels notify on non-existent providers. } else { Log.w(TAG, "Ignoring notify for " + uri + " from " + uid + ": " + msg); return; } } 避过方法其实同notifyChange一样,将NotifyChange 复制一份,如下: static class RegisterContentObserver extends MethodProxy{ @Override public String getMethodName() { return "registerContentObserver"; }

    @Override
    public boolean beforeCall(Object who, Method method, Object... args) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
            return super.beforeCall(who, method, args);
        }
        ApplicationInfo currentApplicationInfo = VClientImpl.get().getCurrentApplicationInfo();
        if (currentApplicationInfo == null) {
            return super.beforeCall(who, method, args);
        }
        int targetSdkVersion = currentApplicationInfo.targetSdkVersion;

        int length = args.length;
        int index = -1;
        for (int i = 0; i < length; i++) {
            Object obj = args[length - 1];
            if (obj != null && obj.getClass() == Integer.class) {
                if ((int) obj == targetSdkVersion) {
                    index = i;
                }
            }
        }
        /*
        In ContentService, it contains this code:

        if (targetSdkVersion >= Build.VERSION_CODES.O) {
            throw new SecurityException(msg);
        } else {
            if (msg.startsWith("Failed to find provider")) {
                // Sigh, we need to quietly let apps targeting older API
                // levels notify on non-existent providers.
            } else {
                Log.w(TAG, "Ignoring notify for " + uri + " from " + uid + ": " + msg);
                return;
            }
        }
        we just modify the targetSdkVersion dynamic to fake it.
        */
        if (index != -1) {
            args[index] = Build.VERSION_CODES.N_MR1;
        }

        return super.beforeCall(who, method, args);
    }

    @Override
    public boolean isEnable() {
        return isAppProcess();
    }
}

上述问题,就解决了,

wenlai521 commented 3 years ago

楼上的方案有效 解决了