Java AndroidManifest.xml赢得';不能正确编译
我对Android清单文件有问题。我在网上看了一个例子,和往常一样,代码中有错误。我已经修复了所有与java相关的错误,但是Android清单文件中有一些我不太熟悉的错误 代码如下:Java AndroidManifest.xml赢得';不能正确编译,java,android,xml,manifest,Java,Android,Xml,Manifest,我对Android清单文件有问题。我在网上看了一个例子,和往常一样,代码中有错误。我已经修复了所有与java相关的错误,但是Android清单文件中有一些我不太熟悉的错误 代码如下: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.dji.FPVDemo" andro
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dji.FPVDemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature android:name="android.hardware.usb.accessory" android:required="false" />
<uses-feature android:name="android.hardware.usb.host" android:required="false" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<uses-library android:name="com.android.future.usb.accessory" />
<meta-data
android:name="com.dji.sdk.API_KEY"
android:value="" />
<activity
android:name=".\DJIAoaActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:screenOrientation="sensorLandscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
</activity>
<activity
android:name=".FPVActivity"
android:label="@string/app_name" >
</activity>
</application>
</manifest>
我认为错误在于GUI组件的命名不正确,但我可能错了。我想知道你们是怎么想的。也许我错过了一些简单的事情 问题在于您的
res/values/strings.xml
文件没有
app\u name
。主题和启动器图标也是如此。确保这些资源可用,然后重新构建您的项目。检查您是否已创建strings.xml文件,以及该文件是否具有应用程序名称的键值对。或者尝试在标签中给出值,例如
android:label=“My App”此错误是因为您的项目没有res文件夹 Eclipse和Android Studio中的res文件夹不同 中的资源文件夹 Eclipse»
*[项目]/res*
Android Studio»*[module]/src/main/res*
在图中可以看到
»了解更多信息
例如在Eclipse中 对于这个错误
Error:(18, -1) Android Resource Packaging: [FPVDemo] C:\Users\Jesse\Desktop\Android-FPVDemo-Part1-master\FPVDemo\bin\AndroidManifest.xml:18: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(18, -1) Android Resource Packaging: [FPVDemo] C:\Users\Jesse\Desktop\Android-FPVDemo-Part1-master\FPVDemo\bin\AndroidManifest.xml:18: error: Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:(18, -1) Android Resource Packaging: [FPVDemo] C:\Users\Jesse\Desktop\Android-FPVDemo-Part1-master\FPVDemo\bin\AndroidManifest.xml:18: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher').
在res/values文件夹中创建string.xml并添加
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">YOUR APP NAME</string>
</resources>
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
在res/values文件夹中创建style.xml并添加
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">YOUR APP NAME</string>
</resources>
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
复制res/drawable hdpi文件夹中的应用程序图标
如果使用Android Studio您可以转到此链接以获取更多信息您的string.xml文件是否包含
app_name
id?第一个问题您是否使用androidStudio?您缺少资源转到res文件夹,然后转到values文件夹并在strings.xml中声明我的app name,还要确保您的values文件夹中有styles.xml,并且它包含一个名为apptheme的样式标记。res文件放在哪里?我把所有合适的文件放在项目中,它仍然会产生相同的结果errors@johnjil我在Eclipse和Android Studio中添加了更多关于res文件夹url的信息,图片如下