새소식

mobile/🤖 Cordova

[하이브리드 앱] 위치: org.apache.cordova.PluginManager.getPlugin

728x90

[하이브리드 앱] 위치: org.apache.cordova.PluginManager.getPlugin


앱을 테스트할때는 이상이 없었는데

구글 플레이 스토어에 등록하고 실제로 서비스를 진행하였을 때


java.lang.NullPointerException

위치: org.apache.cordova.PluginManager.getPlugin

...라는 에러가 발생했네요.


결론적으로 해결되었습니다. 저의 경우입니다.


index.html

--------------------------

<body>


<script type="text/javascript" charset="utf-8" src="cordova.js"></script>

<script type="text/javascript" charset="utf-8" src="index.js"></script>


</body

--------------------------

index.js


document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {

document.addEventListener("backbutton", onBackKeyDown, true);

window.localStorage.setItem("uniqueKey", "globalbridge");;

}

--------------------------



이러한 결과를 아래처럼 변경하니 해결되었습니다. 감사합니다.


<body>

<script type="text/javascript" charset="utf-8" src="cordova.js"></script>

<script>

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {

document.addEventListener("backbutton", onBackKeyDown, true);

window.localStorage.setItem("uniqueKey", "globalbridge");;

}

</script>

</body>



java.lang.RuntimeException: Unable to start activity ComponentInfo{com.globalbridge.trustframe/com.globalbridge.trustframe.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7406)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null object reference
at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:171)
at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:97)
at org.apache.cordova.PluginManager.init(PluginManager.java:86)
at org.apache.cordova.CordovaWebViewImpl.init(CordovaWebViewImpl.java:115)
at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:149)
at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:224)
at com.globalbridge.trustframe.MainActivity.onCreate(MainActivity.java:29)
at android.app.Activity.performCreate(Activity.java:6904)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
... 9 more


반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.