首页 > 解决方案 > 如何更改 Android 应用中的默认活动?

问题描述

几个月前我曾经使用这个apk进行学习,最近几天我再次尝试使用它,但自从我上次使用它后,应用程序登录系统崩溃了。它使用了排行榜和 1vs1 测验的登录页面,但我不需要这些功能,我只需要学习环境。

但是为了进入学习环境,你必须登录,并且由于登录不再起作用,我决定自己动手编辑应用程序以绕过登录页面,我已经完成了我的研究今天掉进兔子洞8个小时,现在我终于放弃了。

这是 AndroidManifest.xml 代码的一部分:

<application android:allowBackup="true" android:appComponentFactory="androidx.core.app.CoreComponentFactory" android:icon="@mipmap/ic_app" android:label="@string/app_name" android:name="ro.umfquiz.umfquiz.presentation.UMFQuizApp" android:supportsRtl="true" android:theme="@style/AppTheme">
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
        <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="@string/admob_app_id"/>
        <activity android:name="ro.umfquiz.umfquiz.presentation.login.AuthenticationActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden|adjustPan"/>
        <activity android:name="ro.umfquiz.umfquiz.presentation.login.FirstActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
        <activity android:name="ro.umfquiz.umfquiz.presentation.login.RegisterActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
        <activity android:name="ro.umfquiz.umfquiz.presentation.login.LoginActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
        <activity android:label="@string/app_name" android:name="ro.umfquiz.umfquiz.presentation.main.MainActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name="ro.umfquiz.umfquiz.presentation.ModeSelectionActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
        <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:label="@string/app_name" android:name="com.facebook.FacebookActivity" android:theme="@style/com_facebook_activity_theme"/>
        <activity android:exported="true" android:name="com.facebook.CustomTabActivity" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="@string/fb_login_protocol_scheme"/>
            </intent-filter>
        </activity>
        <activity android:label="@string/training_mode" android:name="ro.umfquiz.umfquiz.presentation.testselection.training.TrainingSelectActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
        <activity android:label="@string/exam_mode" android:name="ro.umfquiz.umfquiz.presentation.testselection.exam.ExamSelectActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
        <activity android:label="@string/title_activity_quiz" android:name="ro.umfquiz.umfquiz.presentation.quiz.types.exam.QuizExamActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysHidden"/>
       

我使用第 3 方应用程序查找登录页面的名称,名称为“ro.umfquiz.umfquiz.presentation.login.AuthenticationActivity”。我了解到具有 action.MAIN 和 category.LAUNCHER 的意图过滤器的活动是默认启动的活动,我尝试将该意图过滤器标签移至 MainActivity,然后移至 ModeSelectionActivity、FirstActivity 等,但都没有工作,我仍然登陆登录页面。移动意图标签后,我总是重新编译签名并重新安装 apk,并确保保存更改。

我还尝试在许多与登录相关的活动上使用 android:enabled="false",该版本无法签名.. idk?

所以请帮助我,我真的需要这个应用程序才能工作。这是apk,如果您不信任我,可以检查它是否有病毒,但我保证这是安全的。

我使用的工具是:apktool、MT Manager、apk-signer、Current Activity、Notepad ++。

链接到 apk:Google 云端硬盘

标签: androidandroid-studioapk

解决方案


要更改默认活动,您只需移动显示的代码

    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>

到你想要的活动。现在,应用程序是否会在您这样做之后运行 - 这取决于它是否需要来自该登录服务器的数据,以及如果它无法访问他们的服务器,它是否进行了防御性编码以不崩溃。当它尝试从服务器访问所需的数据时,它很可能会立即或在一段时间后崩溃。但是您可能可以在没有它的情况下使用某些应用程序,这取决于他们如何编码以及应用程序如何工作的许多因素。


推荐阅读