已解决错误: 'android.content.res.Resources$Theme android.content.Context.getTheme()' on a null object re
2017-11-01 18:00
1511 查看
报这种错误,但是程序强制退出。11-18 16:02:26.490: W/WindowManager(312): Token{420aaa08 ActivityRecord{41c5fef8 com.rk.jcz/.IndexActivity}} failed creating starting window11-18 16:02:26.490: W/WindowManager(312): android.view.InflateException: Binary XML file line #34: Error inflating class <unknown>11-18 16:02:26.490: W/WindowManager(312): at android.view.LayoutInflater.createView(LayoutInflater.java:606)11-18 16:02:26.490: W/WindowManager(312): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)11-18 16:02:26.490: W/WindowManager(312): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)11-18 16:02:26.490: W/WindowManager(312): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)11-18 16:02:26.490: W/WindowManager(312): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)11-18 16:02:26.490: W/WindowManager(312): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)11-18 16:02:26.490: W/WindowManager(312): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)11-18 16:02:26.490: W/WindowManager(312): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)11-18 16:02:26.490: W/WindowManager(312): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2753)11-18 16:02:26.490: W/WindowManager(312): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2813)11-18 16:02:26.490: W/WindowManager(312): at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1554)11-18 16:02:26.490: W/WindowManager(312): at com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:1369)11-18 16:02:26.490: W/WindowManager(312): at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:6677)11-18 16:02:26.490: W/WindowManager(312): at android.os.Handler.dispatchMessage(Handler.java:99)11-18 16:02:26.490: W/WindowManager(312): at android.os.Looper.loop(Looper.java:137)11-18 16:02:26.490: W/WindowManager(312): at com.android.server.wm.WindowManagerService$WMThread.run(WindowManagerService.java:703)11-18 16:02:26.490: W/WindowManager(312): Caused by: java.lang.reflect.InvocationTargetException11-18 16:02:26.490: W/WindowManager(312): at java.lang.reflect.Constructor.constructNative(Native Method)11-18 16:02:26.490: W/WindowManager(312): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)11-18 16:02:26.490: W/WindowManager(312): at android.view.LayoutInflater.createView(LayoutInflater.java:586)11-18 16:02:26.490: W/WindowManager(312): ... 15 more
解决方案:AndroidManifest.xml 工程的这个文件中,如果 <application android:name=".v3.JCZApp" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/ThemeActivity" ></application>这部分,有指定了theme: ,我这里是 android:theme="@style/ThemeActivity" ,然后查看详细的@style/ThemeActivity 定义如下: <style name="ThemeActivity" mce_bogus="1" > <item name="android:windowAnimationStyle">@style/Animation.Activity.jcz</item> <item name="android:windowNoTitle">true</item> </style>有的朋友点出了关键点:theme,就是主题定义,在这个style中,加上 parent="android:Theme" ,再运行,发现问题解决,改后的style如下: <style name="ThemeActivity" mce_bogus="1" parent="android:Theme"> <item name="android:windowAnimationStyle">@style/Animation.Activity.jcz</item> <item name="android:windowNoTitle">true</item> </style>
解决方案:AndroidManifest.xml 工程的这个文件中,如果 <application android:name=".v3.JCZApp" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/ThemeActivity" ></application>这部分,有指定了theme: ,我这里是 android:theme="@style/ThemeActivity" ,然后查看详细的@style/ThemeActivity 定义如下: <style name="ThemeActivity" mce_bogus="1" > <item name="android:windowAnimationStyle">@style/Animation.Activity.jcz</item> <item name="android:windowNoTitle">true</item> </style>有的朋友点出了关键点:theme,就是主题定义,在这个style中,加上 parent="android:Theme" ,再运行,发现问题解决,改后的style如下: <style name="ThemeActivity" mce_bogus="1" parent="android:Theme"> <item name="android:windowAnimationStyle">@style/Animation.Activity.jcz</item> <item name="android:windowNoTitle">true</item> </style>
相关文章推荐
- Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
- 解决 android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c 错误
- 我的Android进阶之旅------>解决错误:You need to use a Theme.AppCompat theme (or descendant) with this activity.
- android.content.res.Resources$NotFoundException错误的解决办法
- android错误之android.content.res.Resources$NotFoundException:
- android错误之android.content.res.Resources$NotFoundException:
- Android报Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0 .解决办法
- 错误:android.content.res.Resources$NotFoundException: String resource ID #0x1
- android nullpointerexception ContextWrapper.getResources()
- Android错误解决 Call requires API level 3 (current min is 1): android.opengl.GLSurfaceView#getResources
- 解决android.content.res.Resources NotFoundException的一个方法
- 关于android.content.res.Resources$NotFoundException: Resource is not a Drawable 问题的解决办法
- 解决android.content.res.Resources NotFoundException的一个方法
- 【Android】You need to use a Theme.AppCompat theme (or descendant) with this activity解决方法
- android.content.res.Resources$NotFoundExcept 错误
- android错误之android.content.res.Resources$NotFoundException:
- 解决android.content.res.Resources NotFoundException的一个方法(转)
- android错误之:android.content.res.Resources$NotFoundException: String resource ID #0x1
- Android报Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0 .解决办法
- 错误:android.content.res.Resources$NotFoundException: String resource ID #0x583e