我只是在Play商店上传一个应用程序,当我从eclipse导出它并将其安装在我的手机上时,apk工作正常但是当我从Play商店下载它时,应用程序启动,但当我进入其中一个活动,它崩溃,有人知道为什么会这样吗?
这是xml文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/maths"
android:background="@android:color/white" />
<Button
android:id="@+id/button2"
android:layout_width="205dp"
android:layout_height="50dp"
android:layout_alignLeft="@+id/button1"
android:layout_centerVertical="true"
android:background="@android:color/transparent"
android:onClick="derivadas" />
<Button
android:id="@+id/button1"
android:layout_width="205dp"
android:layout_height="50dp"
android:layout_above="@+id/button2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="58dp"
android:background="@android:color/transparent"
android:onClick="integrales" />
<com.google.ads.AdView android:id="@+id/ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="my_unit_id"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
</RelativeLayout>
这是java文件:
package com.whaoapps.maths;
import whao.whaoapps.maths.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void derivadas(View view) {
Intent i = new Intent(this, Derivadas.class );
startActivity(i);
}
public void integrales(View view) {
Intent i = new Intent(this, Integrales.class );
startActivity(i);
}
android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="whao.whaoapps.maths"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/maths_icono"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
android:name="com.whaoapps.maths.MainActivity"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.maths.Derivadas"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar"></activity>
<activity
android:name="com.example.maths.Integrales"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar"></activity>
</application>
</manifest>
logcat:
06-29 22:38:01.649: E/Trace(797): error opening trace file: No such file or directory (2)
06-29 22:38:02.509: D/dalvikvm(797): GC_FOR_ALLOC freed 30K, 6% free 2421K/2572K, paused 69ms, total 75ms
06-29 22:38:02.549: I/dalvikvm-heap(797): Grow heap (frag case) to 3.944MB for 1536016-byte allocation
06-29 22:38:02.629: D/dalvikvm(797): GC_FOR_ALLOC freed <1K, 4% free 3920K/4076K, paused 68ms, total 68ms
06-29 22:38:02.719: D/dalvikvm(797): GC_CONCURRENT freed <1K, 4% free 3920K/4076K, paused 7ms+5ms, total 90ms
06-29 22:38:03.109: D/dalvikvm(797): GC_FOR_ALLOC freed <1K, 4% free 3920K/4076K, paused 44ms, total 44ms
06-29 22:38:03.159: I/dalvikvm-heap(797): Grow heap (frag case) to 7.239MB for 3456016-byte allocation
06-29 22:38:03.259: D/dalvikvm(797): GC_CONCURRENT freed 0K, 3% free 7295K/7452K, paused 27ms+25ms, total 101ms
06-29 22:38:04.550: E/ActivityThread(797): Failed to find provider info for com.google.plus.platform
06-29 22:38:05.149: D/gralloc_goldfish(797): Emulator without GPU emulation detected.
06-29 22:38:05.350: D/dalvikvm(797): DexOpt: --- BEGIN 'ads-1379280169.jar' (bootstrap=0) ---
06-29 22:38:06.529: D/dalvikvm(797): DexOpt: --- END 'ads-1379280169.jar' (success) ---
06-29 22:38:06.539: D/dalvikvm(797): DEX prep '/data/data/whao.whaoapps.maths/cache/ads-1379280169.jar': unzip in 2ms, rewrite 1180ms
06-29 22:38:06.879: I/Ads(797): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script> <script>AFMA_getSdkConstants();AFMA_buildAdURL({"preqs":0,"session_id":"6254903385152313017 ","seq_num":"1","slotname":"a151ce6445b3e0b","u_w":320,"msid":"whao.whaoapps.maths","cap":"m,a","adtest":"on","js":"afma-sdk-a- v6.4.1","bas_off":0,"net":"ed","app_name":"1.android.whao.whaoapps.maths","hl":"en","gnt":3 ,"carrier":"310260","u_audio":4,"kw": [],"u_sd":1.5,"simulator":1,"ms":"ZeQ_cKiodIlN1adygvxO5ZOoFFWjLE8bYjR8zs_pCCtj9mYXmhY4OMigY hlvPG7fJ4-YNPUD3Z2NT4pl_84gKUFmOc2_1W1au-Zdpq9- 83i3xteRaBkgpZ3ArzzqQJS9dnIJrYbQINyYFFwouz1CeNG9d7fbMGx235Ssqsw6ennKpIgQ-L1HY37_TNGzedm- UnW7wbiuzYFUQ_OSTU2r6uUZvhSODXn3ABDeeVj- StHUkhwvppVJJEzLMfk5C1WloxxDjsKwYPwBB1xH_JTTZe_HPT7UAz86za0QURLntFcfwL7eUvjdpKDZ8wyts5WLneh tHII8_To6D1k- EhAG6g","isu":"B3EEABB8EE11C2BE770B684D95219ECB","format":"320x50_mb","oar":0,"ad_pos": {"height":0,"visible":0,"y":0,"x":0,"width":0},"u_h":533,"pt":1,"bas_on":0,"ptime":0}); </script></head><body></body></html>
06-29 22:38:10.549: I/Ads(797): Received ad url: <url: "http://googleads.g.doubleclick.net:80/mads/gma? preqs=0&session_id=6254903385152313017&seq_num=1&u_w=320&msid=whao.whaoapps.maths&cap=m%2Ca &adtest=on&js=afma-sdk-a- v6.4.1&bas_off=0&net=ed&app_name=1.android.whao.whaoapps.maths&hl=en&gnt=3&carrier=310260&u _audio=4&kw&u_sd=1.5&ms=ZeQ_cKiodIlN1adygvxO5ZOoFFWjLE8bYjR8zs_pCCtj9mYXmhY4OMigYhlvPG7fJ4- YNPUD3Z2NT4pl_84gKUFmOc2_1W1au-Zdpq9- 83i3xteRaBkgpZ3ArzzqQJS9dnIJrYbQINyYFFwouz1CeNG9d7fbMGx235Ssqsw6ennKpIgQ-L1HY37_TNGzedm- UnW7wbiuzYFUQ_OSTU2r6uUZvhSODXn3ABDeeVj- StHUkhwvppVJJEzLMfk5C1WloxxDjsKwYPwBB1xH_JTTZe_HPT7UAz86za0QURLntFcfwL7eUvjdpKDZ8wyts5WLneh tHII8_To6D1k- EhAG6g&isu=B3EEABB8EE11C2BE770B684D95219ECB&format=320x50_mb&oar=0&u_h=533&bas_on=0&ptime=0 &u_so=p&imbf=%40installed_markets%40&output=html®ion=mobile_app&u_tz=0&client_sdk=1&ex=1 &slotname=a14e8f77524dde8&kw_type=broad&gsb=3g&caps=inlineVideo_interactiveVideo_mraid1_th_ autoplay_mediation_sdkAdmobApiForAds_di&eisu=v1uf_PFAf_H9_QQTmhwcoo0wKn4MLPeVcgtRkIvO13XjHy moqTZX3qG6cdpp4M0sZUHIMnL3Ho- 8tvaKJBNCtTDFfhjXzfkMdU2aBZtJpSD0e1o5h5TiQch9IGQzc8lu&et=519&jsv=50" type: "admob" afmaNotifyDt: "null" activationOverlayUrl: "null" useWebViewLoadUrl: "false">
06-29 22:38:10.679: I/Ads(797): Ad url modified to http://googleads.g.doubleclick.net:80/mad s/gma? preqs=0&session_id=6254903385152313017&seq_num=1&u_w=320&msid=whao.whaoapps.maths&cap=m%2Ca &adtest=on&js=afma-sdk-a- v6.4.1&bas_off=0&net=ed&app_name=1.android.whao.whaoapps.maths&hl=en&gnt=3&carrier=310260&u _audio=4&kw&u_sd=1.5&ms=ZeQ_cKiodIlN1adygvxO5ZOoFFWjLE8bYjR8zs_pCCtj9mYXmhY4OMigYhlvPG7fJ4- YNPUD3Z2NT4pl_84gKUFmOc2_1W1au-Zdpq9- 83i3xteRaBkgpZ3ArzzqQJS9dnIJrYbQINyYFFwouz1CeNG9d7fbMGx235Ssqsw6ennKpIgQ-L1HY37_TNGzedm- UnW7wbiuzYFUQ_OSTU2r6uUZvhSODXn3ABDeeVj- StHUkhwvppVJJEzLMfk5C1WloxxDjsKwYPwBB1xH_JTTZe_HPT7UAz86za0QURLntFcfwL7eUvjdpKDZ8wyts5WLneh tHII8_To6D1k- EhAG6g&isu=B3EEABB8EE11C2BE770B684D95219ECB&format=320x50_mb&oar=0&u_h=533&bas_on=0&ptime=0 &u_so=p&imbf=8008&output=html®ion=mobile_app&u_tz=0&client_sdk=1&ex=1&slotname=a14e8f775 24dde8&kw_type=broad&gsb=3g&caps=inlineVideo_interactiveVideo_mraid1_th_autoplay_mediation_ sdkAdmobApiForAds_di&eisu=v1uf_PFAf_H9_QQTmhwcoo0wKn4MLPeVcgtRkIvO13XjHymoqTZX3qG6cdpp4M0sZ UHIMnL3Ho-8tvaKJBNCtTDFfhjXzfkMdU2aBZtJpSD0e1o5h5TiQch9IGQzc8lu&et=519&jsv=50
06-29 22:38:10.679: I/Ads(797): Request scenario: Online server request.
06-29 22:38:13.068: D/webviewglue(797): nativeDestroy view: 0x2a239478
06-29 22:38:13.109: I/Ads(797): onReceiveAd()
06-29 22:38:13.369: D/dalvikvm(797): GC_FOR_ALLOC freed 2050K, 25% free 6747K/8920K, paused 109ms, total 119ms
06-29 22:38:13.469: D/webviewglue(797): nativeDestroy view: 0x2a2336f0
06-29 22:38:13.639: D/TilesManager(797): Starting TG #0, 0x2a23a460
06-29 22:38:15.938: D/AndroidRuntime(797): Shutting down VM
06-29 22:38:15.938: W/dalvikvm(797): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
06-29 22:38:16.020: E/AndroidRuntime(797): FATAL EXCEPTION: main
06-29 22:38:16.020: E/AndroidRuntime(797): java.lang.IllegalStateException: Could not execute method of the activity
06-29 22:38:16.020: E/AndroidRuntime(797): at android.view.View$1.onClick(View.java:3599)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.view.View.performClick(View.java:4204)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.view.View$PerformClick.run(View.java:17355)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.os.Handler.handleCallback(Handler.java:725)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.os.Handler.dispatchMessage(Handler.java:92)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.os.Looper.loop(Looper.java:137)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-29 22:38:16.020: E/AndroidRuntime(797): at java.lang.reflect.Method.invokeNative(Native Method)
06-29 22:38:16.020: E/AndroidRuntime(797): at java.lang.reflect.Method.invoke(Method.java:511)
06-29 22:38:16.020: E/AndroidRuntime(797): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-29 22:38:16.020: E/AndroidRuntime(797): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-29 22:38:16.020: E/AndroidRuntime(797): at dalvik.system.NativeStart.main(Native Method)
06-29 22:38:16.020: E/AndroidRuntime(797): Caused by: java.lang.reflect.InvocationTargetException
06-29 22:38:16.020: E/AndroidRuntime(797): at java.lang.reflect.Method.invokeNative(Native Method)
06-29 22:38:16.020: E/AndroidRuntime(797): at java.lang.reflect.Method.invoke(Method.java:511)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.view.View$1.onClick(View.java:3594)
06-29 22:38:16.020: E/AndroidRuntime(797): ... 11 more
06-29 22:38:16.020: E/AndroidRuntime(797): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {whao.whaoapps.maths/com.whaoapps.maths.Integrales}; have you declared this activity in your AndroidManifest.xml?
06-29 22:38:16.020: E/AndroidRuntime(797): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.app.Activity.startActivityForResult(Activity.java:3370)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.app.Activity.startActivityForResult(Activity.java:3331)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.app.Activity.startActivity(Activity.java:3566)
06-29 22:38:16.020: E/AndroidRuntime(797): at android.app.Activity.startActivity(Activity.java:3534)
06-29 22:38:16.020: E/AndroidRuntime(797): at com.whaoapps.maths.MainActivity.integrales(MainActivity.java:23)
06-29 22:38:16.020: E/AndroidRuntime(797): ... 14 more
06-29 22:38:20.989: I/Process(797): Sending signal. PID: 797 SIG: 9
答案 0 :(得分:0)
确保您已宣布您的活动
com.whaoapps.maths.Integrales
在清单中。
您忘记将“示例”更改为“whaoapps”
<activity
android:name="com.**example**.maths.Integrales"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar"></activity>