質問

I'm struggling with adding a library to my project. I've been following a few other SOs as well as the tictactoemain/lib sample Android provides, but I'm still getting a "unable to find explicit activity class" error. The library package I included showing up under Android Dependencies is com.example.surveymetest. I suspect the issue is how I'm calling/defining the activity in the manifest but I can't seem to get it right. Any ideas where I'm going wrong?

Here's my manifest:

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

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />

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

<activity
android:name="com.example.surveymedemo.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.surveymetest.SurveyActivity"
android:label="@string/app_name" >
</activity>
<activity android:name="com.example.surveymetest.TakeSurveyActivity" >
</activity>

<provider
android:name="com.example.surveymetest.SurveyMeContentProvider"
android:authorities="io.surveyme.ContentProviders.SurveyMeContentProvider"
android:exported="true" >
</provider>
</application>

</manifest>

Calling the Activity:

package com.example.surveymedemo;

import com.example.surveymetest.StartSurveyActivity;
import com.example.surveymetest.SurveyMe;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent i = new Intent(this, StartSurveyActivity.class);
startActivity(i);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}
役に立ちましたか?

解決

Add:

<activity
    android:name="com.example.surveymetest.StartSurveyActivity"
    android:label="@string/app_name" >
</activity>

to your manifest and you should be good.

(you only defined com.example.surveymetest.SurveyActivity)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top