Android SDK 31 Bits
This issue describes the needed improvements to support Android SDK 31 known for now. There might be more
When building locally with
android.sdkVersion=31
android.targetSdkVersion=31
android.xactivity=android:exported="true"
build hints,
the resulting Android Studio project contains
compileSdkVersion 30
buildToolsVersion '30'
targetSdkVersion 31
Note: this seems to have been fixed, please check
AndroidManifest.xml Error:android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify an explicit value for \\android:exported\when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
android:exported="false" is missing from Facebook's activity,service and receiver (using FB SDK)
This also affects Firebase's manifest as seen in https://www.reddit.com/r/cn1/comments/x6qzi9/you_uploaded_an_apk_or_android_app_bundle_which/
The Locally created gradle project needs:
In Gradle.properties
android.useAndroidX=true
android.enableJetifier=true
This may only be necessary when the native code makes use of new features such as new PendingIntent flags (FLAG_MUTABLE)
android.useAndroidX=true
android.enableJetifier=true
These properties don't seem to be necessary for Hello World. @javieranton-zz , Can you try to produce a test case that includes minimal changes from Hello world that require these build hints. I'd like to better understand when these hints are necessary before just adding them.
I think they become necessary when a PendingIntent.FLAG_MUTABLE is used (native code)
I'm skeptical that FLAG_MUTABLE itself requires AndroidX. Are you using Android X APis in your native code?
You are right, that doesn't affect that
I am indeed using Android X APIs. I think I found the problem. I have always had my build hint android.useAndroidX=true but the local build doesn't produce the corresponding
android.useAndroidX=true
android.enableJetifier=true
attributes in the gradle.properties file. I have always used the build server because it saves me time building and testing so perhaps I never even noticed this. I am only using the local build now since I need to make these changes manually to build with target 31
If possible, please make the local build do all of the above changes and also change the below from compile to implementation. The latter is required when building with newer gradle versions
compile 'com.facebook.android:facebook-android-sdk:11.2.0'
compile 'com.google.android.gms:play-services-auth:12.0.1'
compile 'com.google.android.gms:play-services-location:12.0.1'
compile 'com.google.android.gms:play-services-maps:12.0.1'
I have changed all gradle dependencies to use implementation when the android.useAndroidX flag is on. This will be in the next plugin update. 7.0.83. You'll need to make sure you update your cn1.plugin.version in your pom.xml file when that update is out.