Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
活动类不存在-Android_Android_Eclipse_Android Fragments - Fatal编程技术网

活动类不存在-Android

活动类不存在-Android,android,eclipse,android-fragments,Android,Eclipse,Android Fragments,此处经常讨论此主题,但当我尝试在emulator中启动项目时,收到错误: cat=[android.intent.category.LAUNCHER] cmp=com.google.android.mzm/.FirstPage } [2013-11-18 22:23:25 - MZM] ActivityManager: Error type 3 [2013-11-18 22:23:25 - MZM] ActivityManager: Error: Activity class {com.goog

此处经常讨论此主题,但当我尝试在emulator中启动项目时,收到错误:

cat=[android.intent.category.LAUNCHER] cmp=com.google.android.mzm/.FirstPage }
[2013-11-18 22:23:25 - MZM] ActivityManager: Error type 3
[2013-11-18 22:23:25 - MZM] ActivityManager: Error: Activity class
{com.google.android.mzm/com.google.android.mzm.FirstPage} does not exist.
我从一开始就遇到了这个问题,重命名包后问题仍然存在

我的项目包含一个主要活动(第一页)和三个片段。清单中只提到主要活动

从相对类名中的完全限定类名编辑清单中的android:name标记不会改变任何内容

一些IntelliJ用户建议“在运行/调试配置屏幕的常规选项卡下选中“部署应用程序”复选框”。作为一个adt捆绑包eclipse用户,我有什么类似的东西吗

我的.apk有些问题,有时会消失。在我的项目属性中,我选中了“is library”标志,否则我会收到其他错误。也许这和我的活动课问题有关

我的舱单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.mzm"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="14" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.google.android.mzm.FirstPage"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

谢谢。

您的舱单无效。请将uses sdk标记放在清单标记的主体内

在我的项目属性中,我选中了“is library”标志-cause 否则我会收到额外的错误


这几乎肯定是错误的。您不希望您的项目成为一个库。您应该修复项目中的错误。

在Android studio中,我也遇到了同样的问题,只需退出IDE,删除.idea/workspace.xml并重新启动即可解决


没有为android使用Eclipse,因此无法具体说明。

为什么要使用
com.android.google
软件包?我认为这是个坏主意。这是在另一个论坛上解决活动课问题的方法。我对其他包名也有相同的错误。对不起,我没有正确标记它。清单现在已经完成,sdk标记现在看起来应该正确了。为什么Android Studio要创建一个没有uses sdk标记的清单文件??但话说回来,这只是一个糟糕的测试版产品。好的,谢谢。我删除了库标志并得到一个“无法执行dex:java.nio.BufferOverflowException。检查Eclipse日志中的堆栈跟踪。”根据我清理的项目,但错误仍然存在:java.nio.BufferOverflowException位于java.nio.Buffer.nextputinex(未知源)位于java.nio.HeapByteBuffer.putShort(未知源)在com.android.dex.dex$Section.writeShort(dex.java:818)在com.android.dex.dex$Section.writeTypeList(dex.java:870)在com.android.dx.merge.dexmmerge$3.write(dexmmerge.java:437)有几种解决方案。其中之一可能也是你的解决方案。可能是让不同的包导入同一个类。你的构建路径上有ActionbarSherlock和android fragment compat jar吗?因为这可能是一个错误。解决方案:在我的项目中取消选中“is library”标志+恢复到SDK构建工具18.1.1
package com.google.android.mzm;

import android.os.Bundle;
import android.support.v4.view.ViewPager;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;

public class FirstPage extends SherlockFragmentActivity {

private ViewPager mViewPager;
private TabsAdapter mTabsAdapter;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.pager);
    setContentView(mViewPager);

    final ActionBar bar = getSupportActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayShowTitleEnabled(false);
    bar.setDisplayShowHomeEnabled(false);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText("Schritt 1"), Fragment_1.class, null);
    mTabsAdapter.addTab(bar.newTab().setText("Schritt 2"), Fragment_2.class, null);
    mTabsAdapter.addTab(bar.newTab().setText("Schritt 3"), Fragment_3.class, null);

}       
}