【问题标题】:Eclipse Error in emulator [Unfortunately, "AppNameHere" has stopped working]模拟器中的 Eclipse 错误 [不幸的是,“AppNameHere”已停止工作]
【发布时间】:2013-11-09 01:26:43
【问题描述】:

我希望能得到任何帮助。我在这方面真的很糟糕,我不知道在做什么。

这里是日志

这是模拟器中的错误

编辑

这是AndroidManifest中的代码

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

    <activity android:name="com.google.ads.AdActivity"
                         android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

    <activity
        android:name="com.example"
        android:label="@string/app_name"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Black.NoTitleBar"
        android:screenOrientation="portrait">

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

我真的不知道活动名称是什么,但这里有一些来自activity.java的代码

import java.io.IOException;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.AssetFileDescriptor;

import android.util.Log;
import android.view.KeyEvent;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import com.google.analytics.tracking.android.EasyTracker;
import com.google.ads.*;
import com.google.ads.AdRequest.ErrorCode;

@SuppressLint({ "SetJavaScriptEnabled", "JavascriptInterface" })
public class activity extends Activity implements AdListener {
  public  MediaPlayer player = new MediaPlayer();
  public WebView webView;
  AssetFileDescriptor afd = null;
  private InterstitialAd interstitial;

  public void onCreate(Bundle savedInstanceState)
  {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

  this.webView = ((WebView)findViewById(R.id.webView));
        this.webView.getSettings().setJavaScriptEnabled(true);
        this.webView.setWebChromeClient(new WebChromeClient());
        this.webView.addJavascriptInterface(this, "activity");
        this.webView.loadUrl("file:///android_asset/index.html");

非常感谢你的帮助

我变了

<activity android:name="com.google.ads.AdActivity"

<activity android:name="com.example.Activity"

保存,清理并尝试再次运行它,但它仍然给我 appname has stop working

这里是logcat

11-08 20:50:48.770: W/dalvikvm(1342): threadid=1: thread exiting with uncaught exception (group=0x41465700)
11-08 20:50:48.810: E/AndroidRuntime(1342): FATAL EXCEPTION: main
11-08 20:50:48.810: E/AndroidRuntime(1342): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.example}: java.lang.ClassNotFoundException: Didn't find class "com.example" on path: DexPathList[[zip file "/data/app/com.example-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example-2, /system/lib]]
11-08 20:50:48.810: E/AndroidRuntime(1342):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at android.os.Looper.loop(Looper.java:137)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at android.app.ActivityThread.main(ActivityThread.java:5103)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at java.lang.reflect.Method.invokeNative(Native Method)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at java.lang.reflect.Method.invoke(Method.java:525)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-08 20:50:48.810: E/AndroidRuntime(1342):     at dalvik.system.NativeStart.main(Native Method)
11-08 20:50:48.810: E/AndroidRuntime(1342): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example" on path: DexPathList[[zip file "/data/app/com.example-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example-2, /system/lib]]

【问题讨论】:

  • 贴出相关代码
  • 您的活动名称是什么?是com.example。发布活动代码
  • 更改为 &lt;activity android:name="com.example.activity" 我会考虑重命名活动,同时考虑到 com.example 是包名称
  • @Raghunandan 更多帮助,请
  • 非常感谢 raghunandan 和 kabuko,它起作用了 raghunandan 也说过,但我误解了,所以非常感谢你们!

标签: android eclipse android-activity


【解决方案1】:

在您的清单中,您将活动名称指定为com.example,它实际上应该是您的活动名称:com.example.activity。改变这个:

<activity
    android:name="com.example"

到这里:

<activity
    android:name="com.example.activity"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-26
    • 2014-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多