0

I am facing an AAPT2 error, this is due to the upgrade of Android Studio.

After a lot of Internet Search, i figured it must be something with the xml in the Android Manifest. I tried different things, chanching the structre, but not sucessful yet. Do have experience with the AndroidManifest.xml and AAPT2? Here's mine

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="ch.workouttracker"
    android:versionCode="1"
    android:versionName="1.0" >

    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the 'MyLocation' functionality.
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="AppTheme">

        <activity android:name=".TrackActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ProfileActivity"
            android:label="@string/title_activity_profile" >

        </activity>
        <activity
            android:name=".TrackCardioActivity"
            android:label="@string/title_activity_track_cardio">

            <meta-data
                android:name="com.google.android.geo.API_KEY"
                android:value="@string/google_maps_key" />

        </activity>
        <activity
            android:name=".TrackWorkoutActivity"
            android:label="@string/title_activity_track_workout" >

        </activity>
        <activity
            android:name=".LogoutActivity"
            android:label="@string/title_activity_logout">

        </activity>
        <activity
            android:name=".SettingsActivity"
            android:label="@string/title_activity_settings" >

        </activity>
        <activity
            android:name=".DashbordActivity"
            android:label="@string/title_activity_dashboard" >

        </activity>
        <activity
            android:name=".CreatePlanActivity"
            android:label="@string/title_activity_create_plan" >

        </activity>
        <activity
            android:name=".CreateExerciseActivity"
            android:label="@string/title_activity_create_exercise" >

        </activity>
        <activity
            android:name=".EditActivity"
            android:label="@string/title_activity_edit" >

        </activity>
        <activity
            android:name=".LoginActivity"
            android:label="@string/title_activity_login" >

        </activity>
        <activity
            android:name=".WorkoutDetailActivity"
            android:label="@string/title_activity_workout_detail" >

        </activity>
        <activity
            android:name=".PlanDetailActivity"
            android:label="@string/title_activity_plan_detail" >

        </activity>
        <activity android:name=".CalendarActivity" >

        </activity>
        <activity android:name=".EditExerciseActivity">

        </activity>
    </application>
</manifest>

I can't find the problem. Maybe you can.

Christian Bohli
  • 331
  • 1
  • 4
  • 15
  • Add `android.enableAapt2=false` in gradle file for quick fix. – Abhi Apr 07 '18 at 12:16
  • this is not a fix, just a workaround and it is deprecated by now – Christian Bohli Apr 07 '18 at 12:19
  • Yes it is a workaround. You can run `assembleDebug` in gradle console to find the specific line in XML causing the error. – Abhi Apr 07 '18 at 12:21
  • C:\Users\DonBolli\StudioProjects\Workouttracker\app\build\intermediates\manifest s\full\debug\AndroidManifest.xml:35: AAPT: error: 'AppTheme' is incompatible wit h attribute theme (attr) reference. error: failed processing manifest. – Christian Bohli Apr 07 '18 at 12:25

1 Answers1

1

Try @style/Apptheme instead of just Apptheme.

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
Abhi
  • 3,431
  • 1
  • 17
  • 35
  • C:\Users\DonBolli\StudioProjects\Workouttracker\app\build\intermediates\manifest s\full\debug\AndroidManifest.xml:35: AAPT: error: resource style/AppTheme (aka c h.workouttracker:style/AppTheme) not found. error: failed processing manifest. – Christian Bohli Apr 07 '18 at 12:34
  • Does the style `AppTheme` exist in your styles.xml? – Abhi Apr 07 '18 at 12:35
  • No, like before the upgrade – Christian Bohli Apr 07 '18 at 12:37
  • Post your styles.xml – Abhi Apr 07 '18 at 12:40
  • – Christian Bohli Apr 07 '18 at 12:43
  • There you go. Just change the style name to `AppTheme` from login. – Abhi Apr 07 '18 at 12:44
  • Or instead use `android:theme="@style/login"` in your Manifest. – Abhi Apr 07 '18 at 12:50
  • C:\Users\DonBolli\StudioProjects\Workouttracker\app\src\main\res\xml\pref_genera l.xml:4: AAPT: error: attribute defaultValue (aka ch.workouttracker:defaultValue ) not found. C:\Users\DonBolli\StudioProjects\Workouttracker\app\src\main\res\xml\pref_genera l.xml:4: AAPT: error: attribute key (aka ch.workouttracker:key) not found. C:\Users\DonBolli\StudioProjects\Workouttracker\app\src\main\res\xml\pref_genera l.xml:4: AAPT: error: attribute summary (aka ch.workouttracker:summary) not foun d. error: failed linking file resources. – Christian Bohli Apr 07 '18 at 15:13
  • not implementng code, just upgrading android studio – Christian Bohli Apr 08 '18 at 08:19
  • after a lot of removing and commenting out. it is finally compiling – Christian Bohli Apr 08 '18 at 08:55