android fully_qualified_classname is not assignable to 'android.app.application'

1.2k views Asked by At

I just created a new project in android studio. FRESH NEW PROJECT. No activities. Just one single java class named MyApplication. I have extended that class with 'Application' so it's a subclass of Application. Now I go to modify my manifest file to add

android:name=".MyApplication"

And of course, of course, the gradle gods are angered and send me this curse:

om.my_name.the_project_name.MyApplication' is not assignable to 'android.app.Application' less... (Ctrl+F1)

Please help me solve why I would get this error!

Full manifest code:

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

<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />

<application
    android:name=".MyApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".LoginActivity"
        android:label="@string/app_name"
        android:windowSoftInputMode="adjustResize|stateVisible" >
    </activity>
</application>

2

There are 2 answers

1
slackbot39243 On

Well, I already finished writing the question when I decided to try another thing to fix it. It turns out that it was in a package that the android manifest wasn't picking up. My advice is to either create an entire new project and just make sure you're creating packages off the package that AS puts it's first activity file in, that or, try to move all your files into the fully qualified package directory/whatever_the_hell_it_is. So ultimately, just make sure your packages are organized under the first given one

0
Eric B. On

I just got this error in an existing project at a seemingly random point for ALL the activities in my manifest. After an clean/rebuild, then invalidate cache and restart, doing a Gradle resync finally made the errors go away.

For this project, I'm using Gradle 1.5 and a target SDK of 23, but that probably makes no difference.