Unresolved package "generated" in AndroidManifest.xml

Viewed 6458

In my Android Studio androidManifest.xml file, I found an unresolved package generated. How can I fix it?

The issued code is : android:name=".provider.generated.SquawkProvider

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.aaa">

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

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

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

<provider
    android:name=".provider.generated.SquawkProvider"
     <!--  shows unresolved package "generated" -->

    android:authorities="com.example.android.aaa.provider.provider"
    android:exported="false" >
</provider>

<activity
    android:name=".following.FollowingPreferenceActivity"
    android:parentActivityName=".MainActivity">
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value=".MainActivity" />
</activity>

<service
    android:name=".fcm.MyFirebaseMessagingService">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT"/>
    </intent-filter>
</service>

</application>
</manifest>
4 Answers

This issue stems from annotation processing now being included in Gradle from version 2.2. You can fix project and get it running with the following changes.

Project level "build.gradle" remove this line:

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'

App level "build.gradle" remove this line:

apply plugin: 'android-apt'

and change this line replacing apt with annotationProcessor:

apt 'net.simonvt.schematic:schematic-compiler:0.6.3'

If the above responses don't work for you, make sure you are using the latest version of Android Studio and gradle plugin (4.4 as of this post) and have changed all the 'compile' lines with 'implementation'.

After that try Build -> Clean Project then Build -> Rebuild Project. (All of this after following @drspaceboo's answer of deleting classpath and plugin lines, then changing apt to annotationProcessor.)

Try this:-

Go to File -> Invalidate Caches / Restart and then Invalidate and Restart.

Related