Since Android Gradle plugin was updated, it now requires JDK 11.
Fixes:
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.4.0.
Required by:
project :
> No matching variant of com.android.tools.build:gradle:7.4.0 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.6' but:
- Variant 'apiElements' capability com.android.tools.build:gradle:7.4.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
Fix the issues that were reported because of that change:
WARNING:The specified Android SDK Build Tools version (28.0.3) is ignored, as it is below the minimum supported version (30.0.3) for Android Gradle Plugin 7.4.0.
Android SDK Build Tools 30.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
android:exported needs to be explicitly specified for element <activity#com.crocoapps.javafilestoragetest2.MainActivity>. 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.
Setting the namespace via a source AndroidManifest.xml's package attribute is deprecated.
Please instead set the namespace (or testNamespace) in the module's build.gradle file, as described here: https://developer.android.com/studio/build/configure-app-module#set-namespace
This migration can be done automatically using the AGP Upgrade Assistant, please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
.../keepass2android/src/java/KP2ASoftkeyboard_AS/app/src/main/AndroidManifest.xml:5:5-46 Warning:
uses-sdk:targetSdkVersion value (14) specified in the manifest file is ignored. It is overridden by the value declared in the DSL or the variant API, or 1 if not declared/present. Current value is (18).
Some targets still target v8.0 (api26):
src/KeePassLib2Android/KeePassLib2Android.csproj: <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
src/KP2AKdbLibraryBinding/KP2AKdbLibraryBinding.csproj: <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
src/ZlibAndroid/ZlibAndroid.csproj: <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
src/PluginSdkBinding/PluginSdkBinding.csproj: <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
src/PCloudBindings/PCloudBindings.csproj: <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
src/AndroidFileChooserBinding/AndroidFileChooserBinding.csproj: <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
src/TwofishCipher/TwofishCipher.csproj: <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
So we need it in ANDROID_SDK_ROOT.
Otherwise build fails with this error (on macos & windows):
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Tooling.targets(100,5): error XA5207: Could not find android.jar for API level 26. This means the Android SDK platform for API level 26 is not installed. Either install it in the Android SDK Manager (Tools > Android > Android SDK Manager...), or change the Xamarin.Android project to target an API version that is installed. (C:\Android\android-sdk\platforms\android-26\android.jar missing.) [D:\a\keepass2android\keepass2android\src\TwofishCipher\TwofishCipher.csproj]
* make changes to comply with new target sdk version requirements (mostly Exported-attribute and mutability flags)
* drop samsung fingerprint support (as suggested by Samsung), would require more hacks to keep it with the new target sdk version
* add build-properties.props to allow specifying a flavor in VS builds.