I have a Unity3D game published on Android, and it have worked well so far.
However, the Android Vitals Dashboard is now reporting a lot of crashes. Here's the detailed info:
By Android version: Android 9 4500 100.0%
Stacktrace:
java.lang.Error: FATAL EXCEPTION [Thread-360]
Unity version : 2017.3.1p3
Device model : Google Pixel
Device fingerprint: google/sailfish/sailfish:9/PQ2A.190305.002/5240760:user/release-keys
Caused by
at lt.b (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:2)
at ls.a (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:1)
at lu.a (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:18)
at com.google.android.gms.ads.internal.util.ar.a (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:10)
at kx.a (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:7)
at kx.run (com.google.android.gms.policy_ads_fdr_dynamite#30000#30000.238272502.238272502:2)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at ac.loadClass (com.google.android.gms.dynamite_dynamiteloader#16089081#16.0.89 (100400-239467275):4)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
My AndroidResolverDependencies.xml file:
<dependencies>
<packages>
<package>com.android.support:customtabs:[26.0.0, 27.2.0[</package>
<package>com.android.support:support-v4:[26.0.0, 27.2.0[</package>
<package>com.google.android.gms:play-services-ads:17.2.0</package>
<package>com.google.android.gms:play-services-analytics:11.8.0</package>
<package>com.google.android.gms:play-services-base:[10.2.1, 12.1.0[</package>
<package>com.google.android.gms:play-services-location:[10.2.1, 12.1.0[</package>
<package>com.google.firebase:firebase-messaging:[10.2.1, 12.1.0[</package>
</packages>
<files>
<file>Assets/Plugins/Android/android.arch.core.common-1.1.0.jar</file>
<file>Assets/Plugins/Android/android.arch.core.runtime-1.1.0.aar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.common-1.1.0.jar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.livedata-core-1.1.0.aar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.runtime-1.1.0.aar</file>
<file>Assets/Plugins/Android/android.arch.lifecycle.viewmodel-1.1.0.aar</file>
<file>Assets/Plugins/Android/com.android.support.customtabs-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-annotations-27.1.1.jar</file>
<file>Assets/Plugins/Android/com.android.support.support-compat-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-core-ui-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-core-utils-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-fragment-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-media-compat-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.android.support.support-v4-27.1.1.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-17.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-17.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-identifier-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-17.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-analytics-16.0.8.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-analytics-impl-16.0.8.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-base-16.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-basement-16.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-gass-17.2.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-location-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-16.3.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-16.3.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-places-placereport-16.0.0.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-stats-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-tagmanager-v4-impl-16.0.8.aar</file>
<file>Assets/Plugins/Android/com.google.android.gms.play-services-tasks-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.auto.value.auto-value-annotations-1.6.jar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-common-16.1.0.aar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-iid-17.1.2.aar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-iid-interop-16.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-measurement-connector-17.0.1.aar</file>
<file>Assets/Plugins/Android/com.google.firebase.firebase-messaging-17.6.0.aar</file>
</files>
</dependencies>
Target API level: 28
Minimum API level: 16
I've seen a similar thread in Google AdMob's discussion group suggesting to add the following to the AndroidManifest.xml file:
<uses-library android:name="org.apache.http.legacy" android:required="false" />
However:
I'm not sure the problem is caused by any apache-related API.
I'm afraid this will restrict the number of installs in my app since it will be available to a smaller audience in Google Play due to the uses-library declaration.
As per Behavior changes: apps targeting API level 28+
Apache HTTP client deprecation
With Android 6.0, we removed support for the Apache HTTP client.
Beginning with Android 9, that library is removed from the
bootclasspath and is not available to apps by default. To continue using the Apache HTTP client, apps that target Android 9 and above can add the following to their AndroidManifest.xml:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Note: The android:required="false" attribute is required for apps that
have a minimum SDK of 23 or lower, because on devices with API levels
lower than 24, the org.apache.http.legacy library is not available.
(On those devices, the Apache HTTP classes are available on the
bootclasspath.)
As an alternative to using the runtime Apache library, apps can bundle
their own version of the org.apache.http library in their APK. If you
do this, you must repackage the library (with a utility like Jar Jar)
to avoid class compatibility issues with the classes provided in the
runtime.
Related
I have a Xamarin.Forms app targeting Android API Level 30 (Android 11) which had Xamarin.Twilio.AudioSwitch v1.1.3 installed. The app is available in Play Store and was working fine till the time Android 12 was not released.
As soon as Android 12 became available, I got complaints from users using the BLE functionality of the app that they are not able to connect with BLE devices supported by the application.
The Android 12 users were getting the following exception:
java.lang.SecurityException:
at android.os.Parcel.createExceptionOrNull (Parcel.java:2437)
at android.os.Parcel.createException (Parcel.java:2421)
at android.os.Parcel.readException (Parcel.java:2404)
at android.os.Parcel.readException (Parcel.java:2346)
at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteName (IBluetooth.java:5470)
at android.bluetooth.BluetoothDevice.getName (BluetoothDevice.java:1889)
at crc....Adapter_Api21BleScanCallback.n_onScanResult (Native Method)
at crc....Adapter_Api21BleScanCallback.onScanResult (Adapter_Api21BleScanCallback.java:38)
at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper$1.run (BluetoothLeScanner.java:646)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8641)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1133)
The above exception occurs due to the Android 12 Bluetooth permission changes. But this is required only if the app targets API Level 31. But since my app targets API level 30, I was not expecting these changes to be required in my app.
On investigating the issue, I found out that the issue is due to the native Audio Switch v1.1.3 targeting Android API Level 31 (Android 12) as mentioned here: Twilio Audio Switch v1.1.3 but the Xamarin.Twilio.AudioSwitch v1.1.3 binding library specifies MonoAndroid 9.0 (https://www.nuget.org/packages/Xamarin.Twilio.AudioSwitch/1.1.3) due to which I was able to install it for a project targeting API Level 30.
Does this mean that if the app has a package which targets an Android API Level higher than the app itself, the target API level would be dynamically change to higher API level?
Now the problem that I am facing is that I am not able to get this issue fixed for the users who already have the app installed.
I did a downgrade of Xamarin.Twilio.AudioSwitch to v1.1.2 as the native Audio Switch v1.1.2 library targets Android API Level 30 (Android 11) and found that the issue gets solved for new installations of the app. If a user already using a previous version of my app which had the Audio Switch v1.1.3 package and updates to the latest version of app which is using Audio Switch 1.1.2, the user still faces the above exception.
Is there any way that this can be fixed without making the app target Android API level 31 (Android 12) as that would require significant changes to the app?
Note: Asking the users to reinstall the app is not an option for me.
--- This is only supposed to be needed if you target SDK 31 (but need legacy Bluetooth support), but its worth a try ---
Close solution.
In a text editor, edit file YourProject.Android/Properties/AndroidManifest.xml, with changes below.
Rebuild solution.
CHANGE 1:
Bluetooth permissions, point 4., recommends:
Add android:maxSdkVersion="30" to each declared Bluetooth-related permission. Example from doc's code snippet:
<!-- Request legacy Bluetooth permissions on older devices. -->
<uses-permission android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
Perhaps this will clear whatever the OS is remembering re your app's Bluetooth access.
CHANGE 2 (experiments):
EITHER: REMOVE any Bluetooth permissions that were added in SDK 31. ONLY list permissions that existed in SDK 30.
OR: list the permissions app WOULD need if targeted SDK 31, but add android:maxSdkVersion="30", similar to above.
Also consider point 5.:
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
maybe as:
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:maxSdkVersion="30"
android:usesPermissionFlags="neverForLocation" />
What we are doing here is not standard -- "should" simply be ignored on a "target SDK 30" app -- it is an attempt to get OS to clear something it is remembering related to this app.
Hypothesis is that during OS upgrade, OS noticed which apps were using Bluetooth in a way that required additional permissions [due to Twilio.AudioSwitch v1.1.3], and marked them as needing those additional permissions. But then failing when feature used, because permission not declared in manifest.
No, it can't be changed dynamically you have to change it from gradle by yourself.
I want to add flutter_sound_lite to my application, Currently my Android API level is 16 and iOS target is 9.0
Flutter Sound requires an iOS 10.0 SDK and Android API level 21
I want to keep my API level (16) and iOS target(9.0), and add Flutter Sound too, just don't use it on old devices, How can I do it?
For android I add the following line in manifest
<uses-sdk tools:overrideLibrary="com.dooboolab.fluttersound, com.dooboolab.TauEngine" />
But in android log cat I have error
04-17 10:27:08.182 2973-2973/ir.karget E/dalvikvm: Could not find class 'android.media.AudioAttributes$Builder', referenced from method androidx.core.app.NotificationCompat$Builder.setSound
I have following error in Android 9 (Pie) I don't get where is the error I think its related to google gms libs.
java.lang.NoClassDefFoundError:
at fa.b (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):3)
at ez.a (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):3)
at fb.a (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):15)
at com.google.maps.api.android.lib6.drd.al.a (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):6)
at ee.a (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):21)
at ee.run (com.google.android.gms.dynamite_mapsdynamite#14574081#14.5.74 (100400-219897028):8)
Caused by: java.lang.ClassNotFoundException:
at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:169)
at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
at ac.loadClass (com.google.android.gms.dynamite_dynamiteloader#14574081#14.5.74 (100400-219897028):4)
at java.lang.ClassLoader.loadClass (ClassLoader.java:312)
Here is official docs
If you are using com.google.android.gms:play-services-maps:16.0.0 or
below and your app is targeting API level 28 (Android 9.0) or above,
you must include the following declaration within the
element of AndroidManifest.xml.
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
This is handled for you if you are using
com.google.android.gms:play-services-maps:16.1.0 and is not necessary
if your app is targeting a lower API level.
and also add this tag in Menifest.xml
<application
.....
.....
android:usesCleartextTraffic="true">
if you are using send and received request to server like (Volley , retrofit and Http request)
Also try this one (optional)
convert the project to AndroidX make sure backup of project first.
At the moment we have two app versions in production:
as you may see, we have version 1420028 for API levels 19+ and 218 for API levels 7+
Now we've prepared a build for API levels from 16 to 18
We see following error after uploading that build to the GP:
Frankly I can't get what following error message says, it looks grammatically incomplete to me.
This configuration cannot be published for the following reason(s):
It is forbidden that a device upgrading from API levels in range 16-18 to API levels in range 19+ should downgrade from version 1420029 to version 218, which would occur when
Screen layouts containing any of [small#mdpi, small#hdpi, small#xhdpi, small#xxhdpi, normal#mdpi, normal#hdpi, normal#xhdpi, normal#xxhdpi, large#mdpi, large#hdpi, large#xhdpi, large#xxhdpi] and
Features containing all of [android.hardware.LOCATION, android.hardware.location.GPS, android.hardware.screen.PORTRAIT, android.hardware.TOUCHSCREEN, android.hardware.WIFI].
Any way to achieve configuration explained above? Is it a Google Play bug or just me getting something wrong?
The Maps v2 documentation states:
Because version 2 of the Google Maps Android API requires OpenGL ES
version 2, you must add a <uses-feature> element as a child of the
manifest element in AndroidManifest.xml:
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>`
This notifies external services of the
requirement. In particular, it has the effect of preventing Google
Play Store from displaying your app on devices that don't support
OpenGL ES version 2.
In fact, it throws an exception if this is not in the manifest. I don't want to filter my app in the store, I plan to keep using the old maps for old devices, and only show the new maps if the required features are present, detected at runtime rather than before installation.
So how do I do that? Does it have to be something like multiple APKs with different manifests?
Final Update
As of 2013/12/20, the Android Dashboard shows that approximately 100% of devices now support OpenGL 2.0+ so this answer is no longer relevant. You may simply require OpenGL ES 2.0+ in your manifest.
Update
This is fixed as of rev 7 of the Google Play Services SDK add-on. It is safe to use <uses-feature android:glEsVersion="0x00020000" android:required="false"/> and to detect OpenGL ES 2.0 at runtime.
Original answer
It appears that the Google Maps Android API v2 requires an explicit <uses-feature android:glEsVersion="0x00020000" android:required="true/> declaration in AndroidManifest.xml so there is no way to deploy Google Maps Android API v2 services without excluding all OpenGL ES 1.x devices. At the time of this writing, Google's Android Dashboard shows that, among 1.1 and 2.0 devices, 90.8% of devices support 2.0.
On a particular device (Motorola XOOM), this code results in supportsEs2 = true:
// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
However, when there is no <uses-feature> declaration in the manifest, MapFragment is throwing a RuntimeException:
Caused by: java.lang.RuntimeException: Google Maps Android API only supports OpenGL ES 2.0 andabove. Please add <uses-feature android:glEsVersion="0x00020000" android:required="true" /> into AndroidManifest.xml
at maps.y.ae.a(Unknown Source)
at maps.y.bu.a(Unknown Source)
at maps.y.p.onCreateView(Unknown Source)
at com.google.android.gms.maps.internal.IMapFragmentDelegate$Stub.onTransact(IMapFragmentDelegate.java:107)
at android.os.Binder.transact(Binder.java:297)
at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
at com.google.android.gms.internal.c$4.a(Unknown Source)
at com.google.android.gms.internal.c.a(Unknown Source)
at com.google.android.gms.internal.c.onCreateView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:884)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1066)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1168)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:280)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
... 22 more
Here's to hoping that an update to the Maps library will remove this limitation so we can deploy a single APK and use runtime APIs to determine whether or not to load the new Google Maps v2 experience or fall back to another compatible solution.
This is fixed and will be release with next release of Maps Android API as mentioned in issue #4699
I had the same problem, looked around and most of the suggested workaround for the emulator didn't work for me. Then i found a post were the Genymotion emulator was suggested. This emulator supports OpenGL ES version 2. It is also much faster than the standard emulator.