flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.53k stars 451 forks source link

You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode. Find out more about signing. #2868

Open sumitkanoje opened 8 months ago

sumitkanoje commented 8 months ago

Description

Installed the new version pip install flet==0.21.1 I built aab bundle using flet build aab --no-ios-splash --verbose command

After this when I tried uploading the aab file on google play console I got following error

You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode. Find out more about signing.
Screenshot 2024-03-13 at 5 36 43 PM

Below I'm pasting logs from flet build command

Flutter bootstrap directory: /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa
Additional Flutter dependencies:
{}
Creating Flutter bootstrap project...OK
Customizing app icons and splash images...Copying /Users/sumit/Works/Self/Flet/todo/assets/icon.png to /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa/images
OK
Generating app icons...
Run subprocess: ['/Users/sumit/Works/Flutter/flutter-stable/bin/dart', 'run', 'flutter_launcher_icons']
Resolving dependencies in /private/var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa... (4.8s)
Got dependencies in /private/var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa.
Building package executable... (2.0s)
Built flutter_launcher_icons:flutter_launcher_icons.
  ════════════════════════════════════════════
     FLUTTER LAUNCHER ICONS (v0.13.1)                               
  ════════════════════════════════════════════

• Creating default icons Android
• Overwriting the default Android launcher icon with a new icon
• Overwriting default iOS launcher icon with new icon
Creating Icons for Web...              done
Creating Icons for Windows...          done
Creating Icons for MacOS...            done

✓ Successfully generated launcher icons
OK
Generating splash screens...
Run subprocess: ['/Users/sumit/Works/Flutter/flutter-stable/bin/dart', 'run', 'flutter_native_splash:create']
Building package executable... (1.9s)
Built flutter_native_splash:create.
[Android] Creating default splash images
[Android] Creating dark mode splash images
[Android] Creating default android12splash images
[Android] Creating dark mode android12splash images
[Android] Updating launch background(s) with splash image path...
[Android]  - android/app/src/main/res/drawable/launch_background.xml
[Android]  - android/app/src/main/res/drawable-night/launch_background.xml
[Android]  - android/app/src/main/res/drawable-v21/launch_background.xml
[Android]  - android/app/src/main/res/drawable-night-v21/launch_background.xml
[Android] Updating styles...
[Android]  - android/app/src/main/res/values-v31/styles.xml
[Android] No android/app/src/main/res/values-v31/styles.xml found in your Android project
[Android] Creating android/app/src/main/res/values-v31/styles.xml and adding it to your Android project
[Android]  - android/app/src/main/res/values-night-v31/styles.xml
[Android] No android/app/src/main/res/values-night-v31/styles.xml found in your Android project
[Android] Creating android/app/src/main/res/values-night-v31/styles.xml and adding it to your Android project
[Android]  - android/app/src/main/res/values/styles.xml
[Android]  - android/app/src/main/res/values-night/styles.xml
[Web] Creating images
[Web] Creating images
[Web] Creating background images
[Web] Creating CSS
[Web] Updating index.html
╔════════════════════════════════════════════════════════════════════════════╗
║                       NEED A GREAT FLUTTER DEVELOPER?                      ║
╠════════════════════════════════════════════════════════════════════════════╣
║                                                                            ║
║   I am available!  Find me at https://www.linkedin.com/in/hansonjon/       ║
║                                                                            ║
╚════════════════════════════════════════════════════════════════════════════╝

✅ Native splash complete.
Now go finish building something awesome! 💪 You rock! 🤘🤩
Like the package? Please give it a 👍 here: https://pub.dev/packages/flutter_native_splash

OK
Packaging Python app...
Run subprocess: ['/Users/sumit/Works/Flutter/flutter-stable/bin/dart', 'run', 'serious_python:main', 'package', '/Users/sumit/Works/Self/Flet/todo', 
'--mobile', '--platform', 'mobile', '--dep-mappings', 'flet=flet-embed', '--req-deps', 'flet-embed', '--exclude', 'build']
Building package executable... (1.3s)
Built serious_python:main.
Running package command
Creating asset directory: /private/var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa/app
Copying Python app from /Users/sumit/Works/Self/Flet/todo to /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/serious_python_tempYoMJ7M
Configured mobile platform with sitecustomize.py at /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/serious_python_sitecustomizeKi71iy/sitecustomize.py
Installing dependencies [flet-embed==0.21.1] with pip command to /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/serious_python_tempYoMJ7M/__pypackages__
Extracting Python distributive from /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/cpython-3.11.6+20231002-aarch64-apple-darwin-install_only.tar.gz to /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/hostpython3.11_DMExwb
Compiling Python sources at /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/serious_python_tempYoMJ7M
Delete unnecessary files with extensions: [.py, .c, .h, .typed, .exe, .so, .a, .pdb, .pyd, .dll]
Delete unnecessary files and directories: [__pycache__, bin]
Creating app archive at /private/var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa/app/app.zip from /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/serious_python_tempYoMJ7M
Deleting temp directory /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/serious_python_tempYoMJ7M
Deleting sitecustomize directory /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/serious_python_sitecustomizeKi71iy
Deleting Python directory /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/hostpython3.11_DMExwb
OK
Building .aab bundle for Android...
Run subprocess: ['/Users/sumit/Works/Flutter/flutter-stable/bin/flutter', 'build', 'appbundle']
Resolving dependencies... (1.7s)
  fl_chart 0.65.0 (0.66.2 available)
  flutter_lints 2.0.3 (3.0.1 available)
  flutter_native_splash 2.3.7 (2.3.13 available)
  js 0.6.7 (0.7.1 available)
  leak_tracker 10.0.0 (10.0.4 available)
  leak_tracker_flutter_testing 2.0.1 (3.0.3 available)
  leak_tracker_testing 2.0.1 (3.0.1 available)
  lints 2.1.1 (3.0.0 available)
  material_color_utilities 0.8.0 (0.11.0 available)
  meta 1.11.0 (1.12.0 available)
  package_info_plus 4.2.0 (5.0.1 available)
  petitparser 5.4.0 (6.0.2 available)
  test_api 0.6.1 (0.7.0 available)
  toml 0.14.0 (0.15.0 available)
  vm_service 13.0.0 (14.1.0 available)
  xml 6.3.0 (6.5.0 available)
Got dependencies!
16 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 283452 to 212680 bytes (25.0% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1261080 bytes (23.3% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
/usr/local/share/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-strip: error: '/private/var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa/build/app/intermediates/merged_native_libs/release/out/lib/arm64-v8a/libpythonbundle.so': The file was not recognized as a valid object file

/usr/local/share/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-strip: error: '/private/var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa/build/app/intermediates/merged_native_libs/release/out/lib/armeabi-v7a/libpythonbundle.so': The file was not recognized as a valid object file

/usr/local/share/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-strip: error: '/private/var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa/build/app/intermediates/merged_native_libs/release/out/lib/x86_64/libpythonbundle.so': The file was not recognized as a valid object file

Running Gradle task 'bundleRelease'...                            122.5s
✓ Built build/app/outputs/bundle/release/app-release.aab (41.9MB).
OK
Copying build to build/aab directory...Copying build output from: /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa/build/app/outputs/bundle/release/*
OK
Deleting Flutter bootstrap directory /var/folders/cy/y7tc39gd75q3vk5lmn9_z7xc0000gn/T/flet_flutter_build_bGLZQZPuSa
Success!

Operating system: I'm on Mac OS Sonoma 14.3.1 (23D60)

Additional Details:

flutter doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.2, on macOS 14.3.1 23D60 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS and macOS development.
      Download at: https://developer.apple.com/xcode/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.87.0)
[✓] Connected device (2 available)
[✓] Network resources
applicatlat commented 8 months ago

could you find a solution to it?

xkayo32 commented 8 months ago

Did you manage to solve the problem?

sumitkanoje commented 8 months ago

@xkayo32 @applicatlat Nope, did not hear anything on this from @flet team yet

yucel685 commented 7 months ago

Aynı sorunu yaşıyorum. Serious_python ile flutteri imzalayarak çalıştırmayı denedim. Ama serious_python os error erno 2 hatasını aşamadım

jeongyoungki commented 5 months ago

I found a reason why this happen. because of /android/app/bundle.gradle file.

to build aab to upload play store.

  1. download build template :

  2. fix bundle.grade in template folder ( in this case "D:/Work/Python/flet/template/flet-build-template/{{cookiecutter.out_dir}}/android/app/build.gradle" ) image like below image

  3. build with template ( below is my case )

    flet build aab --template-dir D:/Work/Python/flet/template/flet-build-template

If this have error like below

image

then

  1. make key file (after making key file move the file to D:/Work/key/android/weather/upload-keystore.jks ) image

  2. make key.properties file.

    • D:\Work\Python\flet\template\flet-build-template{{cookiecutter.out_dir}}\android\key.properties image
  3. edit build.gradle file ( D:\Work\Python\flet\template\flet-build-template{{cookiecutter.out_dir}}\android\app\build.gradle).

image

image

  1. build aab

    flet build aab --template-dir D:/Work/Python/flet/template/flet-build-template

Now you can upload aab file.

I successed . !

Thanks

fasilwdr commented 3 months ago

@ndonkoHenri I have resolved the issue by implementing the following changes.

def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) }

def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }

def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }

def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' }

android { namespace "{{ cookiecutter.org_name }}.{{ cookiecutter.project_name }}" compileSdkVersion flutter.compileSdkVersion

packagingOptions {
    jniLibs {
        useLegacyPackaging true
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "{{ cookiecutter.org_name }}.{{ cookiecutter.project_name }}"
    // You can update the following values to match your application needs.
    // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
    minSdkVersion flutter.minSdkVersion
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName

    ndk {
        abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
    }
}

signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
        storePassword keystoreProperties['storePassword']
    }
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.release
    }
}

}

flutter { source '../..' }

dependencies {}