2015-04-23 164 views
0

我對android編程比較陌生,並且試圖在設備上運行應用程序,但在應用程序停止的設備上不斷收到上述消息。我一直在尋找周圍嘗試各種不同的修補程序,但它理應唯一我的代碼,這是在日誌中返回的錯誤:這個問題似乎是與Android Studio - 不幸的是。應用程序已停止

編輯

04-23 12:24:09.609: E/AndroidRuntime(6535): FATAL EXCEPTION: main 
04-23 12:24:09.609: E/AndroidRuntime(6535): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.chris.myapplication/com.example.chris.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #67: Error inflating class <unknown> 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.app.ActivityThread.access$600(ActivityThread.java:123) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.os.Handler.dispatchMessage(Handler.java:99) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.os.Looper.loop(Looper.java:137) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.app.ActivityThread.main(ActivityThread.java:4424) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at java.lang.reflect.Method.invokeNative(Native Method) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at java.lang.reflect.Method.invoke(Method.java:511) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at dalvik.system.NativeStart.main(Native Method) 
04-23 12:24:09.609: E/AndroidRuntime(6535): Caused by: android.view.InflateException: Binary XML file line #67: Error inflating class <unknown> 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.view.LayoutInflater.createView(LayoutInflater.java:606) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:268) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.app.Activity.setContentView(Activity.java:1837) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at com.example.chris.myapplication.MainActivity.onCreate(MainActivity.java:21) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.app.Activity.performCreate(Activity.java:4470) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 
04-23 12:24:09.609: E/AndroidRuntime(6535): ... 11 more 
04-23 12:24:09.609: E/AndroidRuntime(6535): Caused by: java.lang.reflect.InvocationTargetException 
04-23 12:24:09.609: E/AndroidRuntime(6535): at java.lang.reflect.Constructor.constructNative(Native Method) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.view.LayoutInflater.createView(LayoutInflater.java:586) 
04-23 12:24:09.609: E/AndroidRuntime(6535): ... 24 more 
04-23 12:24:09.609: E/AndroidRuntime(6535): Caused by: java.lang.OutOfMemoryError 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.graphics.Bitmap.nativeCreate(Native Method) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.graphics.Bitmap.createBitmap(Bitmap.java:605) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.graphics.Bitmap.createBitmap(Bitmap.java:551) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:531) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:506) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:358) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773) 
04-23 12:24:09.609: E/AndroidRuntime(6535):  at android.content.res.Resources.loadDrawable(Resources.java:1939) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.widget.ImageView.<init>(ImageView.java:119) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.widget.ImageButton.<init>(ImageButton.java:85) 
04-23 12:24:09.609: E/AndroidRuntime(6535): at android.widget.ImageButton.<init>(ImageButton.java:81) 
04-23 12:24:09.609: E/AndroidRuntime(6535): ... 27 more 
04-23 12:24:09.639: I/ActivityManager(350): Process com.google.android.apps.maps:FriendService (pid 6260) has died. 
04-23 12:24:09.669: W/ActivityManager(350): Force finishing activity com.example.chris.myapplication/.MainActivity 

本來這個主題,但是現在我一旦解決了主題問題,就會返回不同的錯誤。在此先感謝您的幫助

+0

你能發佈你的代碼? – Karthikeyan

+0

[This](http://stackoverflow.com/questions/21814825/you-need-to-use-a-theme-appcompat-theme-or-descendant-with-this-activity)似乎解決了同一問題 – Catalina

+0

我有類似的問題,嘗試用Activity替換ActionBarACtivity。 – Raghavendra

回答

0

嘗試以下線

parent="@style/Theme.AppCompat" 

添加到您的風格的.xml

OR

加入這個屬性到你的活動

android:theme="@style/Theme.AppCompat" 
+0

中更新的新錯誤相同的問題希望這可以幫助您! –

相關問題