在我的申请工作正常之前。我刚刚创建了一个新类(在同一个包中)并在清单中声明了它,我仍然得到ActivityNotFoundException
,有时候NoClassDefFoundException
。
TestActivity.java
public class TestActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.order_summary);
}
}
Activity_NewOrder.java
public class Activity_NewOrder extends Activity
try {
//Also tried Intent intent = new Intent(Activity_NewOrder.this, TestActivity.class);
Intent intent = new Intent(getApplicationContext(), TestActivity.class);
startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
的AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mypackage">
<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=".Activities.Activity_OrderSummaryNew"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape" />
<activity
android:name=".Activities.Activity_Login"
android:configChanges="orientation"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activities.Activity_Orders"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape" />
<activity
android:name=".Activities.Activity_NewOrder"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape" />
<activity
android:name=".Activities.Activity_OrderHistory"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape" />
<activity android:name=".Activities.TestActivity" />
</application>
</manifest>