I am having this gradle error when I try to build my app. I have added the suggestion given by the CLI but its not working.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.FILE_PROVIDER_PATHS#resource value=(#xml/provider_paths) from [:nativescript_camera:] AndroidManifest.xml:19:17-55
is also present at [:MultiTypeFilePicker-release:] AndroidManifest.xml:46:17-51 value=(#xml/file_paths).
Suggestion: add 'tools:replace="android:resource"' to <meta-data> element at AndroidManifest.xml to override.
Any help with this?
I am using NativeScript 5.1/Angular 7.
Thanks!
I have fixed this issue adding:
xmlns:tools="http://schemas.android.com/tools"
to the manifest header tag and then adding:
<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.*.*.fileprovider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths" tools:replace="android:resource" />
</provider>
inside the application tag.
Thanks!
Related
I'm new to Xamarin and trying to get OneSignal push notifications working in Android. When running the emulator and I fire a push notification from OneSignal, it comes through successfully on the emulator. However, when I deploy the app via Play Store, and I have the app open, firing a push notification crashes the app with the following error:
java.lang.RuntimeException: Unable to instantiate receiver com.onesignal.GcmBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.onesignal.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.woodfordgroup.whybuycars-Bl5_t81uXklo5mpGZRvJcw==/base.apk"],nativeLibraryDirectories=[/data/app/com.woodfordgroup.whybuycars-Bl5_t81uXklo5mpGZRvJcw==/lib/arm64, /data/app/com.woodfordgroup.whybuycars-Bl5_t81uXklo5mpGZRvJcw==/base.apk!/lib/arm64-v8a, /system/lib64]]
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3432)
at android.app.ActivityThread.access$1400(ActivityThread.java:207)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1712)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6831)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:927)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.onesignal.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.woodfordgroup.whybuycars-Bl5_t81uXklo5mpGZRvJcw==/base.apk"],nativeLibraryDirectories=[/data/app/com.woodfordgroup.whybuycars-Bl5_t81uXklo5mpGZRvJcw==/lib/arm64, /data/app/com.woodfordgroup.whybuycars-Bl5_t81uXklo5mpGZRvJcw==/base.apk!/lib/arm64-v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:171)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateReceiver(AppComponentFactory.java:84)
at androidx.core.app.CoreComponentFactory.instantiateReceiver(Unknown Source:0)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3425)
... 8 more
Is this because the OneSignal library is not being included in the release? I've also seen mention of AndroidX or multi-dex issues. Here is the android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="15" android:versionName="1.0" package="com.woodfordgroup.whybuycars" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<application android:label="WhyBuyCars" android:theme="#style/MainTheme" android:icon="#drawable/whybuycars_icon_512x512">
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="#xml/file_paths" />
</provider>
<receiver android:name="com.onesignal.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.woodfordgroup.whybuycars" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature android-name="android.hardware.camera" android:required="false" android:glEsVersion="0x00030002" />
<permission android:name="com.woodfordgroup.whybuycars.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.woodfordgroup.whybuycars.permission.C2D_MESSAGE" />
</manifest>
And here are my android project properties (target version is 29):
I also wonder if something went wrong with the inclusion of various libraries while I was installing OneSignal from Nuget. Here is my list of project references:
Add this to the proguard file.
-keep class com.onesignal.** { *; }
Source: See oncky's comment on question.
I had exactly the same issue, I could receive notifications without crash if disabled R8 code shrinker in settings ( or adding <AndroidR8ExtraArguments>--no-tree-shaking</AndroidR8ExtraArguments> after the <AndroidLinkTool>r8</AndroidLinkTool> in android .csproject file).
It seems there's some issue with shrinker for onesignal broadcast receiver class
When compiling a cordova macos app with the InAppBrowser plugin installed under Mojave 10.14.2 and Xcode 10.1 I get the following error message:
ERROR: Plugin 'InAppBrowser' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml
I've checked the config.xml, and it contains the correct entry:
<plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
I've looked in /plugins and the plugin and its xml file are there.
I've removed and added the plugin and the platform.
Taking a cue from this old (and marked fixed) bug, I manually inserted the following into the config.xml file in Xcode:
<feature name="InAppBrowser">
<param name="osx-package" value="CDVDevice" />
</feature>
That changes the error message to this:
ERROR: Method 'open:' not defined in Plugin 'InAppBrowser'
Any ideas what's going on here?
<platform name="osx">
...
<feature name="InAppBrowser">
<param name="osx-package" value="CDVInAppBrowser" />
</feature>
...
</platform>
This works for me.
I'm trying to implement the MediaPlugin but I am running into a problem. I have done all steps in the setup instructions and get the following error:
Error: No resource found that matches the given name (at 'resource' with value '#xml/file_paths')
As explained in the setup instructions - in my Android project, I have added a folder inside the Resources-folder, called xml - containing a file called file_paths.xml with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-files-path name="my_images" path="Pictures" />
<external-files-path name="my_movies" path="Movies" />
</paths>
I expect this problem to be related to either the above or the AndroidManifest.xml, so I'll include my complete AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.company.Kvitt" android:installLocation="auto">
<uses-sdk android:minSdkVersion="15" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application android:label="Kvitt.Android">
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="com.company.Kvitt.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths"/>
</provider>
</application>
</manifest>
Any help or ideas on how to solve this error are really appreciated!
The res/xml directory should be in the same sub-folder as other Resources; drawable, layout, mipmap-XXX, etc...
Do a clean all / build all just as a double check
Double-check your xml path in the project: Resources/xml/file_paths.xml
After a build, check the build artifacts for the file in obj/Debug/android/res/xml
If the resource file is not in the build artifacts the likely cause is the build action is wrong
Check that the build action on the file is set to AndroidResource
From the blog post about PhoneGap 6.0.0 being available on Build my understanding is that we can now use the Cordova WKWebView engine with apps build with PhoneGap Build. See:
http://phonegap.com/blog/2016/02/09/phonegap_6_now_on_build/
https://shazronatadobe.wordpress.com/2015/09/09/apache-cordova-ios-4-0-0-and-wkwebview-support/
https://github.com/apache/cordova-plugin-wkwebview-engine
I've updated my config version to include the following but am still getting the default UIWebView:
<preference name="phonegap-version" value="cli-6.0.0" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
Has anyone been able to get this working that could help?
Thanks to this post I found part of my solution http://community.phonegap.com/nitobi/topics/does-phonegap-build-support-wkwebview-with-the-new-cli-6-0 - I was missing the following line in my config.xml:
<plugin name="cordova-plugin-wkwebview-engine"/>
However, I also found that I needed to turn off Hydration to get the app past the "initialising" screen.
I am trying to get admob to work in my Xamarin Android application but I get the following message when trying to display an add:
"You must have AdActivity declared in AndroidManifest.xml with configChanges"
I ave added the Xamarin google play service to my application.
I am set the java heap size to 1G and build with API level 14
I have googled the error message and most answerspoint to the manifest file that needs to include two entries. I have added the entries but still have the problem.
Any idea what I am doing wrong? Here is my Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:installLocation="auto" android:versionName="1.0">
<uses-sdk />
<application android:label="Aftermath">
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
Thanks