我创建了2个版本的应用,一个有一个,一个没有广告。我使用的库几乎包含了整个付费应用。免费版扩展了基本库的HomeScreenActivity,并在单击按钮时启动自己的MainActivity。
该应用程序在我的设备和模拟器上运行良好,但据亚马逊称,它无法在Kindle设备上启动。如果有一个我可以用它来测试它的模拟器会很棒,但它们不再有一个模拟器。他们给我发了以下日志,但我无法弄清楚导致这个循环的原因。
06-02 07:46:46.429: I/ActivityStack(203): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 pkg=com.myandroidapps.thegamefree
cmp=com.myandroidapps.thegamefree/.HomeScreenActivity} from pid 559
06-02 07:46:46.429: V/ActivityStack(203): Prepare open transition: starting ActivityRecord{41bfc198 com.myandroidapps.thegamefree/.HomeScreenActivity}
06-02 07:46:46.484: V/ActivityStack(203): Prepare open transition: prev=ActivityRecord{418e8ae0 com.amazon.kindle.otter/.Launcher}
06-02 07:46:46.515: I/ActivityManager(203): Start proc com.myandroidapps.thegamefree for activity com.myandroidapps.thegamefree/.HomeScreenActivity: pid=2425 uid=10051 gids={3003}
06-02 07:46:46.578: D/dalvikvm(203): GC_CONCURRENT freed 1325K, 50% free 16569K/32903K, paused 2ms+7ms
06-02 07:46:46.672: I/dalvikvm(2425): Could not find method android.content.Context.startActivities, referenced from method android.support.v4.a.a.a
06-02 07:46:46.672: W/dalvikvm(2425): VFY: unable to resolve virtual method 136: Landroid/content/Context;.startActivities ([Landroid/content/Intent;Landroid/os/Bundle;)V
06-02 07:46:46.672: D/dalvikvm(2425): VFY: replacing opcode 0x6e at 0x0007
06-02 07:46:46.687: I/dalvikvm(2425): threadid=1: stack overflow on call to Lcom/myandroidapps/thegamebase/HomeScreenActivity;.onCreate:VL
06-02 07:46:46.687: I/dalvikvm(2425): method requires 12+20+8=40 bytes, fp is 0x56d16318 (24 left)
06-02 07:46:46.687: I/dalvikvm(2425): expanding stack end (0x56d16300 to 0x56d16000)
06-02 07:46:46.687: I/dalvikvm(2425): Shrank stack (to 0x56d16300, curFrame is 0x56d19ec8)
06-02 07:46:46.687: D/AndroidRuntime(2425): Shutting down VM
06-02 07:46:46.687: W/dalvikvm(2425): threadid=1: thread exiting with uncaught exception (group=0x40b0a1f8)
06-02 07:46:46.711: D/dalvikvm(2425): GC_CONCURRENT freed 242K, 3% free 11236K/11527K, paused 1ms+1ms
06-02 07:46:46.765: D/dalvikvm(2425): GC_CONCURRENT freed 415K, 5% free 11331K/11847K, paused 2ms+1ms
06-02 07:46:46.781: D/dalvikvm(2425): GC_FOR_ALLOC freed 182K, 5% free 11332K/11847K, paused 14ms
06-02 07:46:46.789: E/AndroidRuntime(2425): FATAL EXCEPTION: main
06-02 07:46:46.789: E/AndroidRuntime(2425): java.lang.StackOverflowError
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamefree.HomeScreenActivity.onCreateHomeScreenActivity(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegamebase.HomeScreenActivity.onCreate(Unknown Source)
06-02 07:46:46.789: E/AndroidRuntime(2425): at com.myandroidapps.thegam
06-02 07:46:46.805: D/dalvikvm(2425): GC_FOR_ALLOC freed 417K, 5% free 11307K/11847K, paused 12ms
06-02 07:46:46.820: D/dalvikvm(2425): GC_FOR_ALLOC freed 213K, 5% free 11365K/11847K, paused 11ms
06-02 07:46:46.883: W/ActivityManager(203): Force finishing activity com.myandroidapps.thegamefree/.HomeScreenActivity
06-02 07:46:46.883: V/ActivityStack(203): Prepare close transition: finishing ActivityRecord{41bfc198 com.myandroidapps.thegamefree/.HomeScreenActivity}
06-02 07:46:46.969: V/PhoneStatusBar(296): setLightsOn(true)
06-02 07:46:46.976: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:46.976: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.000: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.015: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.023: D/dalvikvm(203): GC_CONCURRENT freed 992K, 49% free 16894K/32903K, paused 4ms+8ms
06-02 07:46:47.047: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.055: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.070: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.086: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.101: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.117: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.140: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.156: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.172: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.187: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.203: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.226: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.383: W/ActivityStack(203): Activity pause timeout for ActivityRecord{41bfc198 com.myandroidapps.thegamefree/.HomeScreenActivity}
06-02 07:46:47.383: V/ActivityStack(203): Prepare close transition: prev=ActivityRecord{41bfc198 com.myandroidapps.thegamefree/.HomeScreenActivity}
06-02 07:46:47.383: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.390: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.555: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.562: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.578: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.594: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.609: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.625: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.648: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.664: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.680: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.695: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.703: V/AlarmManager(203): sending alarm Alarm{41a49968 type 0 com.amazon.ags.app}
06-02 07:46:47.711: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.726: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.750: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.765: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.781: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.797: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.820: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.836: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.851: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.867: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.883: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.906: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.922: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.945: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.953: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:47.976: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
06-02 07:46:48.086: D/dalvikvm(203): GC_CONCURRENT freed 785K, 47% free 17593K/32903K, paused 2ms+5ms
06-02 07:46:48.289: V/Sensors(203): accel data: 0.011975 -0.119751 10.116563
06-02 07:46:49.945: I/WindowManager(203): DIM BEHIND: Window{41c1c3b8 paused=false}
以下是广告支持的HomeScreenActivity的来源:
package com.myandroidapps.thegamefree;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class HomeScreenActivity extends com.myandroidapps.thegamebase.HomeScreenActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((Button)findViewById(R.id.btnStart)).setOnClickListener(
new OnClickListener(){
@Override
public void onClick(View v)
{
startActivity(new Intent(HomeScreenActivity.this, com.myandroidapps.thegamefree.MainActivity.class));
}
}
);
}
}
这是基类:
package com.myandroidapps.thegamebase;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class HomeScreenActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_screen);
((Button)findViewById(R.id.btnStart)).setOnClickListener(
new OnClickListener(){
@Override
public void onClick(View v)
{
startActivity(new Intent(HomeScreenActivity.this, MainActivity.class));
}
}
);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_about)
startActivity(new Intent(HomeScreenActivity.this, com.myandroidapps.myandroidappslib.AboutActivity.class));
else if (id == R.id.action_settings)
startActivity(new Intent(HomeScreenActivity.this, SettingsActivity.class));
else
return super.onOptionsItemSelected(item);
return true;
}
}
任何建议都将受到赞赏。
感谢。