john jil
john jil

Reputation: 41

AndroidManifest.xml won't compile correctly

I am having an issue with the Android Manifest file. I am following an example online, and as usual, the code has errors in it. I have fix all the java related errors but the Android Manifest file has a couple that I am not to familiar with.

Here is the code:

  <?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>

and here are the errors:

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:(45, -1) Android Resource Packaging: [FPVDemo] C:\Users\Jesse\Desktop\Android-FPVDemo-Part1-master\FPVDemo\bin\AndroidManifest.xml:45: 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 'icon' with value '@drawable/ic_launcher').

I am thinking the errors are in a portion where the GUI components are not named correctly, but I could be wrong. I was wondering what you guys think about it. Maybe I am missing something simple.

Upvotes: 2

Views: 898

Answers (3)

sadegh
sadegh

Reputation: 1642

this error because your project don't have res folder

res folder Different in Eclipse and Android Studio

Resources folder in

Eclipse » *[project]/res*

Android Studio » *[module]/src/main/res*

in pic can see

res folder

»for more info Android Studio vs Eclipse folder structure


for example in Eclipse

res

for this error

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').

you make string.xml in res/values folder and add

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">YOUR APP NAME</string>

</resources>

for this error

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').

you make style.xml in res/values folder and add

<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>

for this error

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').

copy your app icon in res/drawable-hdpi folder


if use Android Studio you can go to this link for more info » https://developer.android.com/tools/projects/index.html

Upvotes: 1

Balu SKT
Balu SKT

Reputation: 549

Check whether you have created strings.xml file and which has a key value pair for app_name. Or just try to give the value in label, e.g.

android:label="My App"

Upvotes: 1

pez
pez

Reputation: 4235

The problem is just that your res/values/strings.xml file doesn't have <string> app_name. Same goes for the theme and launcher icon. Make sure those resources are available, then re-build your project.

Upvotes: 0

Related Questions