[英]Adding Shared Library Project Android
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.
我一直在关注其他一些SO,以及Android提供的tictactoemain / lib示例,但仍然收到“无法找到明确的活动类”错误。 The library package I included showing up under Android Dependencies is
com.example.surveymetest
. 我包括在Android Dependencies下显示的库程序包是
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) (您仅定义了com.example.surveymetest.SurveyActivity)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.