简体   繁体   English

在Android而非iOS上使用离子崩溃构建的混合应用程序

[英]hybrid app built with ionic crashes on android but not ios

I'm building an app using the Ionic framework and AngularJS. 我正在使用Ionic框架和AngularJS构建应用程序。 When I run ionic run android the app installs and then crashes on my device. 当我运行ionic run android时,该应用会安装,然后在我的设备上崩溃。 I ran logcat to watch the crash happen and it was throwing java.lang.NumberFormatException: Invalid long: "" 我运行了logcat来观察崩溃的发生,并抛出了java.lang.NumberFormatException: Invalid long: ""

Interestingly the app runs on iOS perfectly fine, it only crashes on android. 有趣的是,该应用程序可以在iOS上完美运行,仅在android上崩溃。 Anywho know what I should be looking for to fix this? 谁知道我应该寻找解决此问题的方法? I'm having a hard time trying to find the issue as the code is in javascript and html so I can't find where the invalid long is. 我很难找到问题,因为代码在javascript和html中,所以我找不到无效的long在哪里。

full log cat of the exception 异常的完整日志

E/AndroidRuntime( 3057): FATAL EXCEPTION: main
E/AndroidRuntime( 3057): Process: com.gravityfusion.findmydriver, PID: 3057
E/AndroidRuntime( 3057): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gravityfusion.findmydriver/com.gravityfusion.findmydriver.CordovaApp}: java.lang.NumberFormatException: Invalid long: ""
E/AndroidRuntime( 3057):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
E/AndroidRuntime( 3057):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
E/AndroidRuntime( 3057):        at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime( 3057):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
E/AndroidRuntime( 3057):        at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3057):        at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 3057):        at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 3057):        at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 3057):        at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 3057):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 3057):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime( 3057): Caused by: java.lang.NumberFormatException: Invalid long: ""
E/AndroidRuntime( 3057):        at java.lang.Long.invalidLong(Long.java:124)
E/AndroidRuntime( 3057):        at java.lang.Long.decode(Long.java:142)
E/AndroidRuntime( 3057):        at org.apache.cordova.CordovaPreferences.copyIntoIntentExtras(CordovaPreferences.java:139)
E/AndroidRuntime( 3057):        at org.apache.cordova.CordovaActivity.loadConfig(CordovaActivity.java:240)
E/AndroidRuntime( 3057):        at org.apache.cordova.CordovaActivity.onCreate(CordovaActivity.java:207)
E/AndroidRuntime( 3057):        at com.gravityfusion.findmydriver.CordovaApp.onCreate(CordovaApp.java:30)
E/AndroidRuntime( 3057):        at android.app.Activity.performCreate(Activity.java:5933)
E/AndroidRuntime( 3057):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 3057):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
E/AndroidRuntime( 3057):        ... 10 more

~edit I can build the app with no errors or warnings using ionic build android . 〜edit我可以使用ionic build androidionic build android没有错误或警告的应用程序。 I can install the app on my device. 我可以在设备上安装该应用程序。 When I go to run it, it instantly crashes. 当我运行它时,它立即崩溃。

Because of this line in the error 由于此行中的错误

at org.apache.cordova.CordovaPreferences.copyIntoIntentExtras(CordovaPreferences.java:139)

I had a look in the config.xml file where the preferences are entered. 我在输入首选项的config.xml文件中进行了查看。 I found several errors in the preferences that iOS defaults but android doesn't like <preference name="BackgroundColor" value="0xffffffff"/> which was <preference name="BackgroundColor" value=""/> 我在iOS默认设置的首选项中发现了几个错误,但android不喜欢<preference name="BackgroundColor" value="0xffffffff"/>这是<preference name="BackgroundColor" value=""/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM