我想得到任何帮助。我真的很沮丧,我不知道自己在做什么。
这是logcat
这是模拟器中的错误
修改
以下是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已停止工作
这是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]]
答案 0 :(得分:2)
在您的清单中,您将活动名称指定为com.example
,其中实际上应该是您的活动名称:com.example.activity
。改变这个:
<activity
android:name="com.example"
对此:
<activity
android:name="com.example.activity"