Reputation: 105
When I try to run the app to see if everything works fine in the emulated phone nothing works and this error shows up I have tried to clean the project and build it again, reinstall everything, restart the computer, I have tried everything but nothing works, ill post my package.json too:
NativePlugin com.capacitorjs.plugins.googlemaps.CapacitorGoogleMapsPlugin failed to load com.getcapacitor.PluginLoadException: Unable to load plugin instance. Ensure plugin is publicly accessible
at com.getcapacitor.PluginHandle.load(PluginHandle.java:107)
at com.getcapacitor.PluginHandle.<init>(PluginHandle.java:65)
at com.getcapacitor.Bridge.registerPlugin(Bridge.java:685)
at com.getcapacitor.Bridge.registerAllPlugins(Bridge.java:641)
at com.getcapacitor.Bridge.<init>(Bridge.java:226)
at com.getcapacitor.Bridge.<init>(Unknown Source:0)
at com.getcapacitor.Bridge$Builder.create(Bridge.java:1560)
at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:48)
at com.getcapacitor.BridgeActivity.onCreate(BridgeActivity.java:42)
at android.app.Activity.performCreate(Activity.java:9002)
at android.app.Activity.performCreate(Activity.java:8980)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1526)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4030)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4235)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:112)
at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:174)
at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:109)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:81)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2636)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8705)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
This is my package.json:
{
"name": "Crucero",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@angular/animations": "^18.0.0",
"@angular/common": "^18.0.0",
"@angular/compiler": "^18.0.0",
"@angular/core": "^18.0.0",
"@angular/fire": "^18.0.1",
"@angular/forms": "^18.0.0",
"@angular/platform-browser": "^18.0.0",
"@angular/platform-browser-dynamic": "^18.0.0",
"@angular/router": "^18.0.0",
"@capacitor/android": "^6.1.2",
"@capacitor/app": "6.0.1",
"@capacitor/core": "6.1.2",
"@capacitor/google-maps": "^6.0.1",
"@capacitor/haptics": "6.0.1",
"@capacitor/keyboard": "6.0.2",
"@capacitor/preferences": "^6.0.2",
"@capacitor/status-bar": "6.0.1",
"@firebase/firestore": "^4.7.4",
"@ionic-native/core": "^5.36.0",
"@ionic/angular": "^8.0.0",
"angularfire2": "^5.4.2",
"firebase": "^10.14.1",
"ionicons": "^7.2.1",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.2.11",
"@angular-eslint/builder": "^18.0.0",
"@angular-eslint/eslint-plugin": "^18.0.0",
"@angular-eslint/eslint-plugin-template": "^18.0.0",
"@angular-eslint/schematics": "^18.0.0",
"@angular-eslint/template-parser": "^18.0.0",
"@angular/cli": "^18.0.0",
"@angular/compiler-cli": "^18.0.0",
"@angular/language-service": "^18.0.0",
"@capacitor/cli": "6.1.2",
"@ionic/angular-toolkit": "^11.0.1",
"@types/jasmine": "~5.1.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~5.1.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.4.0",
"webpack": "^5.96.1"
},
"description": "An Ionic project"
}
Upvotes: 0
Views: 60
Reputation: 1
I had a similar issue. The error logs are ambiguous, so I added console logs in the PluginHandle file (click on the links in your error's stack trace to get there quickly):
try {
this.instance = this.pluginClass.getDeclaredConstructor().newInstance();
return this.loadInstance(instance);
} catch (Exception ex) {
System.err.println("EXCEPTION LOADING PLUGIN:::::");
System.err.println(ex.getCause());
System.err.println(ex.getMessage());
throw new PluginLoadException("Unable to load plugin instance. Ensure plugin is publicly accessible");
}
The output specified that I was missing an API Key in the App Manifest XML. documentation does not clearly specify where you should put the metadata tag:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY_HERE"/>
Turns out, it has to be a direct child of the node, so make sure you put it immediately after the opening tag <application ...>. I'll see if I can get them to improve their error logging. This stumped me for a couple hours.
Upvotes: 0