我有一个项目,Ionic在iOS(模拟器和设备),网络和Android中都有问题。
我已经习惯了创建项目:
ionic platform add android
我用Eclipse打开项目,一切正常,没有错误,CordovaLib正常加载。
当我尝试在设备中部署时,出现此错误:
11-20 15:22:56.350: E/AndroidRuntime(10312): FATAL EXCEPTION: main
11-20 15:22:56.350: E/AndroidRuntime(10312): Process: com.ionicframework.congressapp251163, PID: 10312
11-20 15:22:56.350: E/AndroidRuntime(10312): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ionicframework.congressapp251163/com.ionicframework.congressapp251163.CordovaApp}: java.lang.NullPointerException
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2447)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2507)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.access$900(ActivityThread.java:172)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.os.Handler.dispatchMessage(Handler.java:102)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.os.Looper.loop(Looper.java:146)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.main(ActivityThread.java:5692)
11-20 15:22:56.350: E/AndroidRuntime(10312): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 15:22:56.350: E/AndroidRuntime(10312): at java.lang.reflect.Method.invoke(Method.java:515)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
11-20 15:22:56.350: E/AndroidRuntime(10312): at dalvik.system.NativeStart.main(Native Method)
11-20 15:22:56.350: E/AndroidRuntime(10312): Caused by: java.lang.NullPointerException
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:191)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:114)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.init(PluginManager.java:92)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:383)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:368)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrl(CordovaWebView.java:344)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:389)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.ionicframework.congressapp251163.CordovaApp.onCreate(CordovaApp.java:33)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.Activity.performCreate(Activity.java:5541)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
11-20 15:22:56.350: E/AndroidRuntime(10312): ... 11 more
编辑:
插件尚未复制到Android项目:(
请帮助;)谢谢!!
答案 0 :(得分:5)
我遇到了同样的问题,但是使用这种方式解决了。首先创建项目后,我使用命令ionic build android
构建项目,然后导入它。如果它不工作,请尝试这个
1.使用ionic platform remove android
2.再次添加平台,然后运行。