我正在构建一个从我的旧项目导入的新android项目。在我做了一些修改并创建了一个新活动之后,我注意到在logcat中每当我打开一个黄色错误报告时运行应用程序时的新活动。
我尝试了很多在线提供的方法,比如清理项目,或者将所有类移到一个包中,或者关闭编辑器中的所有布局,或者删除R文件。 有点疯狂,任何帮助都会受到赞赏。
错误如下:
01-17 14:18:20.112: W/ResourceType(6671): Requesting resource 0x7f090001 failed because it is complex
01-17 14:18:20.122: W/PackageManager(6671): Failure retrieving text 0x7f090001 in package study.runtracker
01-17 14:18:20.122: W/PackageManager(6671): android.content.res.Resources$NotFoundException: String resource ID #0x7f090001
01-17 14:18:20.122: W/PackageManager(6671): at android.content.res.Resources.getText(Resources.java:244)
01-17 14:18:20.122: W/PackageManager(6671): at android.app.ApplicationPackageManager.getText(ApplicationPackageManager.java:994)
01-17 14:18:20.122: W/PackageManager(6671): at android.content.pm.ComponentInfo.loadLabel(ComponentInfo.java:85)
01-17 14:18:20.122: W/PackageManager(6671): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
01-17 14:18:20.122: W/PackageManager(6671): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
01-17 14:18:20.122: W/PackageManager(6671): at android.app.ActivityThread.access$800(ActivityThread.java:135)
01-17 14:18:20.122: W/PackageManager(6671): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
01-17 14:18:20.122: W/PackageManager(6671): at android.os.Handler.dispatchMessage(Handler.java:102)
01-17 14:18:20.122: W/PackageManager(6671): at android.os.Looper.loop(Looper.java:136)
01-17 14:18:20.122: W/PackageManager(6671): at android.app.ActivityThread.main(ActivityThread.java:5017)
01-17 14:18:20.122: W/PackageManager(6671): at java.lang.reflect.Method.invokeNative(Native Method)
01-17 14:18:20.122: W/PackageManager(6671): at java.lang.reflect.Method.invoke(Method.java:515)
01-17 14:18:20.122: W/PackageManager(6671): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-17 14:18:20.122: W/PackageManager(6671): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-17 14:18:20.122: W/PackageManager(6671): at dalvik.system.NativeStart.main(Native Method)
以下是R文件中0x7f090001的引用:
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f090001;
}
感谢您的建议,但问题仍然存在,以下是清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="study.runtracker"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="study.runtracker.permission.MAP_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="study.runtracker.permission.MAP_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature android:required="true" android:name="android.hardware.location.gps"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="study.runtracker.RunListActivity"
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="study.runtracker.RunActivity"
android:label="@style/AppTheme" >
</activity>
<activity android:name="study.runtracker.RunMapActivity"
android:label="@style/AppTheme" >
</activity>
<activity android:name="study.runtracker.map.OSMActivity"
android:label="@style/AppTheme" >
</activity>
<receiver android:name="study.runtracker.LocationReceiver"
android:exported="false">
<intent-filter >
<action android:name ="study.runtracker.ACTION_LOCATION"/>
</intent-filter>
</receiver>
<service android:name="study.runtracker.DeadReckoningService"></service>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="balabala"/>
</application>
答案 0 :(得分:1)
<activity android:name="study.runtracker.RunActivity"
android:label="@style/AppTheme" >
label
不能是style
资源。它应该是string
,例如@string/app_name
。
同样适用于清单中的其他一些活动。