Vamsi Challa
Vamsi Challa

Reputation: 11109

Android Studio - Files under the build folder are generated and should not be edited

I have gone through similar questions posted on StackOverflow regarding this issue, but none of them solved my problem.

So, as in all questions, I am getting errors while trying to compile the application.

enter image description here

I know, i shouldn't edit this debug->AndroidManifest.xml file as its auto-generated. But, the app->AndroidManifest.xml file doesn't show any errors??? What should i edit when there are no errors?

here is my AndroidManifest.xml file:

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

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.test.awstestapp">


    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="com.google.android.c2dm.permission.REGISTER" />
    <uses-permission android:name="com.test.awstestapp.permission.C2D_MESSAGE" />

    <permission
        android:name="com.test.awstestapp.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher_image"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name="com.test.awstestapp.AndroidMobilePushApp"
            android:label="@string/app_name"
            android:launchMode="singleTop">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service
            android:name="com.test.awstestapp.MessageReceivingService"
            android:label="com.test.awstestapp.MessageReceivingService">
            <intent-filter>
                <action android:name="com.test.awstestapp.AndroidMobilePushApp" />
                <action android:name="com.test.awstestapp.ExternalReceiver" />

                <category android:name="com.test.awstestapp" />
            </intent-filter>
        </service>

        <receiver
            android:name="com.test.awstestapp.ExternalReceiver"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <action android:name="com.google.android.c2dm.intent.REGISTER" />

                <category android:name="com.test.awstestapp" />
            </intent-filter>
        </receiver>
    </application>
</manifest>

The AndroidManifest.xml file in build->....->debug, is as below:

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

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.test.awstestapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="22" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="com.google.android.c2dm.permission.REGISTER" />
    <uses-permission android:name="com.test.awstestapp.permission.C2D_MESSAGE" />

    <permission
        android:name="com.test.awstestapp.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.USE_CREDENTIALS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher_image"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.test.awstestapp.AndroidMobilePushApp"
            android:label="@string/app_name"
            android:launchMode="singleTop" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service
            android:name="com.test.awstestapp.MessageReceivingService"
            android:label="com.test.awstestapp.MessageReceivingService" >
            <intent-filter>
                <action android:name="com.test.awstestapp.AndroidMobilePushApp" />
                <action android:name="com.test.awstestapp.ExternalReceiver" />

                <category android:name="com.test.awstestapp" />
            </intent-filter>
        </service>

        <receiver
            android:name="com.test.awstestapp.ExternalReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <action android:name="com.google.android.c2dm.intent.REGISTER" />

                <category android:name="com.test.awstestapp" />
            </intent-filter>
        </receiver>
        <!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />
        <activity
            android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
            android:theme="@style/Theme.IAPTheme" />

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.gms.wallet.api.enabled"
            android:value="true" />

        <receiver
            android:name="com.google.android.gms.wallet.EnableWalletOptimizationReceiver"
            android:exported="false" >
            <intent-filter>
                <action android:name="com.google.android.gms.wallet.ENABLE_WALLET_OPTIMIZATION" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

Why is the auto generated manifest different from the original?

Solutions tried till now:

  1. Clean Project
  2. File->Invalidate Caches/Restart
  3. Renamed ic_launcher to ic_launcher_image (just to test if the file name is causing the issue).

Here are the errors that are being shown in Logcat:

enter image description here

How can i solve this?

Upvotes: 0

Views: 8618

Answers (3)

Stefano
Stefano

Reputation: 3215

In android studio you have to modify the gradle file for the versions

Upvotes: 1

Vamsi Challa
Vamsi Challa

Reputation: 11109

I am guessing that Android Studio didn't recognise the images when they are copied using explorer outside the IDE. So, i deleted the folders, created new folders for all 4 drawables and copied the files one by one. Now the errors and gone and the application got compiled.

Upvotes: 0

Aster
Aster

Reputation: 877

In your first screenshot I see red wrigles below the names of two files: AndroidMobilePushApp.java and MessageReceivingService.java. You should solve these errors to solve your build problems. This could magically solve your resource problems, because there is some dependence between correctly building the app, copying the resources to the build map etc.

Upvotes: 0

Related Questions