Я использую apktool, чтобы добавить новое действие в приложение, перекомпилировать и подписать его. который я могу добавлять новые файлы, пока родительская активность не будет appcompact
, что означает, что ваша активность должна иметь тему Theme.AppCompat.
Я добавил тему как в манифесте, так и программно.
<activity
android:theme="@style/AppTheme"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:name=".view.activity.myActivity"
/>
и
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState)
сгенерированное декомпилированное приложение показывает, что манифест сохраняет тему, но выдает исключение, говоря, что вы должны добавить тема.
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2951)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6718)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
03-13 19:47:29.756 14959 14959 E AndroidRuntime: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.