Java &引用;不幸的是,应用程序已停止工作;安卓工作室
请注意,我正在尝试将我的launcher活动更改为我刚刚使用twitter数字开发的身份验证活动,我已经在我的androidJava &引用;不幸的是,应用程序已停止工作;安卓工作室,java,android,xml,Java,Android,Xml,请注意,我正在尝试将我的launcher活动更改为我刚刚使用twitter数字开发的身份验证活动,我已经在我的androidmanifest和java代码中进行了必要的调整,但注意到每次尝试启动时,应用程序都会不断崩溃,身份验证活动的名称是AboutActivity.java,在调试会话期间,我从我的android监视器控制台观察到,这一行在com.close.close.AboutActivity.onCreate(AboutActivity.java:34)以蓝色突出显示 始终指向setC
manifest
和java代码中进行了必要的调整,但注意到每次尝试启动时,应用程序都会不断崩溃,身份验证活动的名称是AboutActivity.java
,在调试会话期间,我从我的android监视器控制台观察到,这一行在com.close.close.AboutActivity.onCreate(AboutActivity.java:34)以蓝色突出显示
始终指向setContentView(R.layout.activity_about)代码>我已经检查了布局,没有发现任何错误,我想我需要第三只眼睛来帮助粉碎这个恼人的错误,注意,我已经检查了其他staackoverflow问题,但是那里的解决方案对我不起作用。多谢各位
这是我的舱单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.close.close"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission
android:name="android.permission.CAMERA"
android:required="true"/>
<uses-feature android:name="android.hardware.camera.any"/>
<android:uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:theme="@style/CustomActionBarTheme">
<service
android:name=".MessageService"
android:enabled="true"/>
<activity
android:name=".AboutActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"/>
<meta-data
android:name="io.fabric.ApiKey"
android:value="34308698bb3cbc96444f2ff10ad1ae167d75d8e9"/>
<activity android:name=".MainActivity">
</activity>
<activity android:name=".Profile_info">
</activity>
<activity
android:name=".ChatActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_chat"
android:launchMode="singleTop">
</activity>
<activity
android:name=".ViewImageActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_view_image"
android:parentActivityName=".ChatActivity"
android:theme="@style/FullscreenTheme">
</activity>
<activity
android:name=".RecordAudioActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_record_audio"
android:parentActivityName=".ChatActivity">
</activity>
<activity
android:name=".PlayVideoActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_play_video">
</activity>
<activity
android:name=".FilePickerActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_file_picker"
android:parentActivityName=".ChatActivity">
</activity>
<activity
android:name=".WebViewActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_web_view"
android:parentActivityName=".ChatActivity">
<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="myweburl"/>
</intent-filter>
</activity>
<activity
android:name=".DrawingActivity"
android:label="@string/title_activity_drawing">
</activity>
</application>
</manifest>
这是我的原木猫
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.close.close/com.close.close.AboutActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2348)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1313)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5348)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:359)
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.close.close.AboutActivity.onCreate(AboutActivity.java:34)
at android.app.Activity.performCreate(Activity.java:6012)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2410)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1313)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5348)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
下面是我的关于.xml的活动
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FD579D"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.close.close.AboutActivity"
android:orientation="horizontal">
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="28dp"
android:gravity="center_horizontal"
android:text="@string/welcome"
android:textColor="#FFFFFF"
android:textSize="37sp"/>
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="80dp"
android:gravity="center_horizontal"
android:text="@string/to"
android:textColor="#FFFFFF"
android:textSize="37sp"/>
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="128dp"
android:gravity="center_horizontal"
android:text="@string/close"
android:textColor="#FFFFFF"
android:textSize="37sp"/>
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="189dp"
android:gravity="center_horizontal"
android:text="@string/about"
android:textColor="#FFFFFF"
android:textSize="18sp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="50dp"
android:weightSum="1"
android:layout_marginStart="164dp"
android:layout_below="@+id/textView4"
android:layout_alignParentStart="true">
</LinearLayout>
<com.digits.sdk.android.DigitsAuthButton
android:id="@+id/auth_button"
android:layout_width="148dp"
android:layout_height="48dp"
android:background="@drawable/dgts__digits_btn"
android:orientation="vertical"
android:layout_marginTop="54dp"
android:layout_below="@+id/textView4"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
更改此选项
public class AboutActivity extends AppCompatActivity {
对此
public class AboutActivity extends Activity {
错误消息显示您需要在此活动中使用Theme.AppCompat主题(或子代)。
您确定您的答案可以解决此问题吗?是的,这就是我发布答案的原因。使用AppCompatActivity
可能有很好的理由。此解决方案实际上没有解决错误中提到的问题。在这种情况下,我看不出使用AppCompat的理由,只有使用活动才能解决问题。它将解决错误,是的。但是如果OP需要使用AppCompatActivity,那么它并不能真正解决整个问题。您应该在回答中对此进行解释,并提供可行的解决方案,以便在必要时继续使用AppCompatActivity。您是否阅读了错误消息?它准确地告诉您如何解决问题。你不明白信息的哪一部分?我们很乐意帮助澄清。请参阅以回答您的问题。请注意,如果您只需在谷歌上搜索错误消息,您会更快地发现这一点。
public class AboutActivity extends Activity {