这个:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.androidbuch.rechner"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7"></uses-sdk>
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:theme="@android:style/Theme.Light">
<activity android:name=".FormularActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
是我的
AndroidManifest.xml
,在第 8 行和第 11 行中我收到错误:
未找到与此匹配的资源 给定名称(在“标签”处,带有值 “@string/app_name”)
未找到与此匹配的资源 给定名称(在“标签”处,带有值 “@string/app_name”)
这真的很奇怪,我没有将值文件夹移动到任何地方。
您是否检查过以确保在 res/values/strings.xml 中定义了字符串资源?
<string name="app_name">"My App"</string>
有时,我注意到 Eclipse 也会抛出错误,如果您有任何有错误的 .xml 文件,则很难跟踪这些错误。我认为解析器恢复得不好,有时您得到的错误可能会产生误导。
一个原因可能是在我的情况下,当您按某种顺序添加和删除项目时,字符串GUI中存在错误
解决方案: 只需在
XML模式而不是 GUI 模式下打开
strings.xml
,您会发现它有所不同,并且在周围或开头粘贴了明显无效的额外文本;虽然它不会在文件上给出错误strings.xml
修复它们,然后清理并运行
我的图像也有同样的错误。只需将扩展名从“.png”或任何你必须的名称重命名为“.jpg”,然后它们在清理项目并重新编译后就可以正常工作。
只需在里面添加上面的行“config.xml”。 android平台底层。工作完美。经过几个小时后,我得到了这个解决方案。
享受你的编码...
解决此问题的方法是确保您的 Cordova CLI 已更新到最新版本,然后启动新应用程序(或重新添加 Android 平台)。
npm i -g cordova@latest
然后:
ionic cordova platform rm android
ionic cordova platform add android
如果您计划使用 cordova-android 6,则需要对 config.xml 进行以下更改:
替换这一行:
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
这样:
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
替换这一行:
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
这样:
<resource-file src="resources/android/xml/network_security_config.xml" target="res/xml/network_security_config.xml" />
当您在 /app/App_Resources/Android/src/main/res 中放置任何内容时,它会自动替换用于构建的默认资源。这是设计使然,允许用户完全覆盖该资源。我同意当前情况会在构建过程中导致意外错误,但可以通过在 strings.xml 中添加以下行来轻松修复它:
<string name="app_name">__NAME__</string>
<string name="title_activity_kimera">__TITLE_ACTIVITY__</string>
我也遇到过同样的问题。从
"@string"
中删除 android:label="@string/app_name"
即可正常工作。
android:label="@string/app_name" -> android:label="app_name"