我是一名在Mac上工作的初學者開發人員。任何有關這個問題的幫助將非常感謝。我的應用程序源代碼是在Buzztouch中創建的。我已經將它導入到Eclipse。我已經設置了SDK。我已成功運行Hello,World應用程序。我試過多次改變目標名稱/ API級別。我試着卸載並重新安裝Eclipse和Android SDK Manager,並刪除並重新安裝了應用程序文件。應用程序不會在模擬器或日蝕設備上運行
我的目標很簡單,就是測試我的應用程序並打包提交給應用商店。
當我嘗試啓動模擬器上的應用程序,我得到的結果如下(應用程序標題已被替換APPNAME隱私,標題本身是正確的格式):
ON logcat的
04-19 18:44:25.187: E/AndroidRuntime(563): FATAL EXCEPTION: main
04-19 18:44:25.187: E/AndroidRuntime(563): java.lang.RuntimeException: Unable to resume activity {com.APPNAME/com.APPNAME.BT_screen_splash}: java.lang.NumberFormatException: Invalid int: "2.5"
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2444)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2472)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1986)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.os.Looper.loop(Looper.java:137)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.reflect.Method.invokeNative(Native Method)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.reflect.Method.invoke(Method.java:511)
04-19 18:44:25.187: E/AndroidRuntime(563): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-19 18:44:25.187: E/AndroidRuntime(563): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-19 18:44:25.187: E/AndroidRuntime(563): at dalvik.system.NativeStart.main(Native Method)
04-19 18:44:25.187: E/AndroidRuntime(563): Caused by: java.lang.NumberFormatException: Invalid int: "2.5"
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.Integer.invalidInt(Integer.java:138)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.Integer.parse(Integer.java:375)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.Integer.parseInt(Integer.java:366)
04-19 18:44:25.187: E/AndroidRuntime(563): at java.lang.Integer.parseInt(Integer.java:332)
04-19 18:44:25.187: E/AndroidRuntime(563): at com.APPNAME.BT_screen_splash.onResume(BT_screen_splash.java:104)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1154)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.Activity.performResume(Activity.java:4539)
04-19 18:44:25.187: E/AndroidRuntime(563): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2434)
04-19 18:44:25.187: E/AndroidRuntime(563): ... 12 more
在控制檯上
[2012-04-19 18:51:57 - APP NAME] Android Launch!
[2012-04-19 18:51:57 - APP NAME] adb is running normally.
[2012-04-19 18:51:57 - APP NAME] Performing com.APPNAME.BT_activity_root activity launch
[2012-04-19 18:51:57 - APP NAME] Automatic Target Mode: launching new emulator with compatible AVD 'APPNAME'
[2012-04-19 18:51:57 - APP NAME] Launching a new emulator with Virtual Device 'APPNAME'
[2012-04-19 18:52:09 - Emulator] 2012-04-19 18:52:09.489 emulator-arm[3242:80b] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
[2012-04-19 18:52:09 - Emulator] emulator: emulator window was out of view and was recentered
[2012-04-19 18:52:09 - Emulator]
[2012-04-19 18:52:09 - APP NAME] New emulator found: emulator-5554
[2012-04-19 18:52:09 - APP NAME] Waiting for HOME ('android.process.acore') to be launched...
[2012-04-19 18:53:07 - APP NAME] HOME is up on device 'emulator-5554'
[2012-04-19 18:53:07 - APP NAME] Uploading APP NAME.apk onto device 'emulator-5554'
[2012-04-19 18:53:09 - APP NAME] Installing APP NAME.apk...
[2012-04-19 18:54:10 - APP NAME] Success!
[2012-04-19 18:54:10 - APP NAME] Starting activity com.APPNAME.BT_activity_root on device emulator-5554
[2012-04-19 18:54:12 - APP NAME] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.APPNAME/.BT_activity_root }
ON仿真器
出現一個彈出窗口,其中顯示「不幸的是,[App的名稱]已停止。」
CODE:BT_screen_splash.java
package com.APPNAME;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
public class BT_screen_splash extends BT_activity_base{
//properties...
String transitionType = "";
int startTransitionAfterSeconds = 0;
int transitionDurationSeconds = 0;
//onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.activityName = "BT_screen_splash";
BT_debugger.showIt(activityName + ":onCreate");
//set the content view...
LinearLayout baseView = (LinearLayout)findViewById(R.id.baseView);
//setup background colors...
BT_viewUtilities.updateBackgroundColorsForScreen(this, this.screenData);
//setup background images..
if(backgroundImageWorkerThread == null){
backgroundImageWorkerThread = new BackgroundImageWorkerThread();
backgroundImageWorkerThread.start();
}
//inflate this views layout file...
//inflate this screens layout file..
LayoutInflater vi = (LayoutInflater)thisActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View thisScreensView = vi.inflate(R.layout.screen_splash, null);
//add the view to the base view...
baseView.addView(thisScreensView);
/*
* *******************************************************************
* Notes:
* screen_splash.xml is an empty layout file. You can add whatever you
* want to it. The image for the splash screen is setup with the
* BT_viewUtilities.updateBackgroundColorsForScreen() method.
* That method sets the background image (the splash image) in this
* screens parent class. BT_activity_base. See above, almost all
* BT screens extend BT_activity_base
********************************************************************
*/
}
//onResume...
public void onResume(){
super.onResume();
//get values..
this.transitionType = BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "transitionType", "");
this.startTransitionAfterSeconds = Integer.parseInt(BT_strings.getJsonPropertyValue(this.screenData.getJsonObject(), "startTransitionAfterSeconds", "0"));
//setup transition if we don't have -1
if(startTransitionAfterSeconds > -1){
delayHandler.removeCallbacks(mDelayTask);
delayHandler.postDelayed(mDelayTask, ((startTransitionAfterSeconds + 1) * 1000));
}
}
//handle touch event..
@Override
public boolean onTouchEvent(MotionEvent event){
//BT_debugger.showIt("BT_screen_splash: touch event..");
//ignore touch events if we have a startTransitionAfterSeconds value..
if(startTransitionAfterSeconds < 1){
if(event.getAction() == MotionEvent.ACTION_DOWN){
animateSplashScreen();
}
}
return false;
}
/////////////////////////////////////////////////////////////////////
//handles question delay updates after each answer
Handler delayHandler = new Handler(){
@Override public void handleMessage(Message msg){
delayHandler.removeCallbacks(mDelayTask);
}
};
private Runnable mDelayTask = new Runnable() {
public void run() {
animateSplashScreen();
}
};
//end timer stuff
/////////////////////////////////////////////////////////////////////
//handles animation...
public void animateSplashScreen(){
BT_debugger.showIt("BT_screen_splash:animateSplashScreen");
//finish this screen so it cannot be returned to...
BT_screen_splash.this.finish();
//the next screen...
BT_item tmpLoadScreenObject = null;
BT_item tmpMenuItemObject = null;
tmpMenuItemObject = new BT_item();
tmpMenuItemObject.setItemId("tempMenuItem");
tmpMenuItemObject.setItemNickname("tempMenuItem");
try{
tmpMenuItemObject.setItemType("BT_menuItem");
tmpMenuItemObject.setJsonObject(new JSONObject("{\"transitionType\":\"fade\"}"));
}catch(Exception e){
}
//next screen to load...either tabbed home or the first screen in the list...
if(APPNAME_appDelegate.rootApp.getTabs().size() > 0){
BT_debugger.showIt("Building tabbed interface...");
//load BT_activity_root_tabs...
tmpLoadScreenObject = new BT_item();
tmpLoadScreenObject.setItemId("tmpRootTabs");
tmpLoadScreenObject.setItemNickname("tmpRootTabs");
try{
tmpLoadScreenObject.setItemType("BT_activity_root_tabs");
tmpLoadScreenObject.setJsonObject(new JSONObject("{}"));
}catch(Exception e){
}
}else{
//find the app's home screen...
tmpLoadScreenObject = APPNAME_appDelegate.rootApp.getHomeScreen();
//flag it as the home screen...
tmpLoadScreenObject.setIsHomeScreen(true);
}
//load...
if(tmpLoadScreenObject != null){
//remember current screen...
APPNAME_appDelegate.rootApp.setCurrentScreenData(tmpLoadScreenObject);
//load screen object...
BT_act_controller.loadScreenObject(this, this.screenData, tmpMenuItemObject, tmpLoadScreenObject);
}
}
}
我已經瀏覽了BT_Splash_screen.java文件,並且沒有在哪裏看到「2.5」 - 任何其他建議? – user1345259 2012-04-19 23:30:08
它可能不會被硬編碼爲「2.5」,但這絕對是它試圖做的。編輯您的問題並從該文件發佈代碼。上面添加了代碼 – FoamyGuy 2012-04-19 23:38:38
。 – user1345259 2012-04-20 00:06:37