Skip to content

[Compatibility] Local Android build fails with SDK 37 because CN1 sources reference FingerprintManager #5701

Description

@jsfan3

Affected target

Android

Version boundary

The first failing platform I observed is Android SDK Platform 37.0, revision 2. An otherwise identical clean project builds successfully with Android SDK Platform 36, revision 2.

Both tests used:

  • Codename One archetype, Maven plugin, and libraries: 7.0.267
  • JDK: OpenJDK 17.0.20
  • Maven: 3.8.7
  • OS: Linux x86_64 (6.8.0-38-generic)
  • Generated Gradle wrapper: 8.13
  • Generated Android Gradle Plugin: 8.13.2

With no Android SDK build hints, cn1:buildAndroidGradleProject selected the highest installed platform and generated:

compileSdkVersion 37
targetSdkVersion 37

The SDK 37 android.jar does not contain android.hardware.fingerprint.FingerprintManager, while the SDK 36 android.jar does.

As a control, I added these settings to common/codenameone_settings.properties, regenerated the Android Gradle project, and ran the same Gradle command:

codename1.arg.android.buildToolsVersion=36
codename1.arg.android.targetSDKVersion=36

This generated compileSdkVersion 36 / targetSdkVersion 36, and assembleDebug completed successfully and produced app-debug.apk.

Minimal reproducer and command

No custom application code is required. The failure occurs in a freshly generated Hello World project:

mvn -B archetype:generate \
  -DarchetypeGroupId=com.codenameone \
  -DarchetypeArtifactId=cn1app-archetype \
  -DarchetypeVersion=7.0.267 \
  -DgroupId=com.example \
  -DartifactId=cn1-android-sdk37-repro \
  -Dversion=1.0-SNAPSHOT \
  -DmainName=Cn1AndroidSdk37Repro \
  -DjavaVersion=17 \
  -DinteractiveMode=false

cd cn1-android-sdk37-repro
mvn -N cn1:buildAndroidGradleProject

cd android/target/cn1-android-sdk37-repro-android-1.0-SNAPSHOT-android-source
./gradlew assembleDebug --no-daemon

Prerequisite for reproducing the default selection: Android SDK Platform 37.0 must be the highest installed platform, and no android.buildToolsVersion override should be set.

The Maven goal succeeds and generates the Android Gradle project. The final assembleDebug command fails during :app:compileDebugJavaWithJavac.

Failure and expected result

The generated project contains Codename One Android implementation sources that import and use android.hardware.fingerprint.FingerprintManager and Activity.FINGERPRINT_SERVICE, notably:

  • com/codename1/impl/android/AndroidBiometrics.java
  • com/codename1/impl/android/AndroidSecureStorage.java

Those symbols are absent from the SDK 37 compile API, so even an unmodified Hello World application fails with 34 Java compilation errors.

Expected result: the Android Gradle project produced by cn1:buildAndroidGradleProject should compile with the SDK platform that the Codename One builder selects by default, or the builder should avoid selecting an incompatible installed platform.

Complete relevant log

> Configure project :app
WARNING: We recommend using a newer Android Gradle plugin to use compile SDK version 37.0

This Android Gradle plugin (8.13.2) was tested up to compile SDK version 36.1.

> Task :app:compileDebugJavaWithJavac
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidBiometrics.java:28: error: package android.hardware.fingerprint does not exist
import android.hardware.fingerprint.FingerprintManager;
                                   ^
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidSecureStorage.java:28: error: package android.hardware.fingerprint does not exist
import android.hardware.fingerprint.FingerprintManager;
                                   ^
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidBiometrics.java:155: error: cannot find symbol
                FingerprintManager fpm = (FingerprintManager)
                ^
  symbol:   class FingerprintManager
  location: class AndroidBiometrics
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidBiometrics.java:156: error: cannot find symbol
                        act.getSystemService(Activity.FINGERPRINT_SERVICE);
                                                     ^
  symbol:   variable FINGERPRINT_SERVICE
  location: class Activity
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidBiometrics.java:274: error: package FingerprintManager does not exist
                FingerprintManager.AuthenticationCallback cb = new FingerprintManager.AuthenticationCallback() {
                                  ^
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidBiometrics.java:309: error: package FingerprintManager does not exist
                fpm.authenticate(new FingerprintManager.CryptoObject(probeCipher), cs, 0, cb, null);
                                                       ^
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidSecureStorage.java:758: error: cannot find symbol
                FingerprintManager fpm = (FingerprintManager)
                ^
  symbol:   class FingerprintManager
  location: class AndroidSecureStorage
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidSecureStorage.java:760: error: cannot find symbol
                                .getSystemService(Activity.FINGERPRINT_SERVICE);
                                                          ^
  symbol:   variable FINGERPRINT_SERVICE
  location: class Activity
<generated-project>/app/src/main/java/com/codename1/impl/android/AndroidSecureStorage.java:772: error: package FingerprintManager does not exist
                fpm.authenticate(crypto, cs, 0, new FingerprintManager.AuthenticationCallback() {
                                                                      ^

34 errors
1 warning

> Task :app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler output below.

BUILD FAILED in 1m 28s
21 actionable tasks: 21 executed

All 34 errors are cascading unresolved references to FingerprintManager, its nested classes/constants, Activity.FINGERPRINT_SERVICE, and the resulting invalid @Override methods in the two files named above.

For comparison, after forcing SDK 36 as described above, the same final command completed with:

> Task :app:compileDebugJavaWithJavac
> Task :app:assembleDebug

BUILD SUCCESSFUL in 2m 20s
32 actionable tasks: 32 executed

Report checks

  • I verified the version boundary or explained why that was not possible.
  • I searched existing issues and discussions for the platform change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions