问题
I am implementing Adobe Creative SDK. I am getting the following error in in my my manifest file:
'com.example.nick.avierytest2.MainActivity is not assignable to android.app.activity'
This is my XML file:
<?xml version="1.0" encoding="utf-8"?>
<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"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
This is my main activity class:
public class MainActivity extends Application implements IAdobeAuthClientCredentials {
/* Be sure to fill in the two strings below. */
private static final String CREATIVE_SDK_CLIENT_ID = "";
private static final String CREATIVE_SDK_CLIENT_SECRET = "";
@Override
public void onCreate() {
super.onCreate();
AdobeCSDKFoundation.initializeCSDKFoundation(
getApplicationContext(),
AdobeAuthIMSEnvironment.AdobeAuthIMSEnvironmentProductionUS
);
}
@Override
public String getClientID() {
return CREATIVE_SDK_CLIENT_ID;
}
@Override
public String getClientSecret() {
return CREATIVE_SDK_CLIENT_SECRET;
}
}
Every other time I have seen this question on stackoverflow it was someone trying to declare a fragment in the manifest but that is not the problem here and I have not been able to find the solution.
Thank you for your help.
回答1:
MainActivity extends Application
Of course an Application
is not assignable to an Activity
.
Either change this to MainActivity extends Activity
, or move the android:name=".MainActivity"
reference in the manifest to the application
tag (and remove that activity
). In the latter case also consider renaming the class from MainActivity
to e.g. MyApplication
.
来源:https://stackoverflow.com/questions/34826726/not-assignable-to-android-app-activity-extends-application