flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
161.83k stars 26.57k forks source link

Android 14 Error #145197

Closed BrillianceOsprey closed 1 week ago

BrillianceOsprey commented 1 month ago

Steps to reproduce

Flutter release code should be work well on every version of android

Expected results

I want to install my app for every version of android because it is working on android 13 and older well , now , it can't do that on android 14

Actual results

I am facing with your app isn't compatible with device for android 14, I have done latest dependencies and latest sdk , especially on some device i can't even installed.

Code sample

Code sample ```dart [Paste your code here] ```

Screenshots or Video

Screenshots / Video demonstration ![bug](https://github.com/flutter/flutter/assets/56672040/582c3c60-423d-4756-a836-75cbaca3c416)

Logs

Logs ```console ```

Flutter Doctor output

Doctor output ```console Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.19.3, on macOS 14.3.1 23D60 darwin-arm64, locale en-TH) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.87.2) [✓] Connected device (3 available) ! Error: Browsing on the local area network for HHA1157. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27) [✓] Network resources • No issues found! ```
huycozy commented 1 month ago

Hi @BrillianceOsprey Is the APK file installed normally on other Android OS versions? (Android 12/13..)

What is your minSdkVersion and targetSdkVersion in /android/app/build.gradle file? Please also check this: https://developer.android.com/about/versions/14/behavior-changes-all#minimum-target-api-level

BrillianceOsprey commented 1 month ago

Yes apk installed normally on other version

Here is my build.gradle file

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
}

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'
}

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

android {
    namespace "com.north.user"
    compileSdkVersion 34
    ndkVersion flutter.ndkVersion

    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 "com.s4.user"
        // 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.
        // 29
        minSdkVersion 29
        targetSdkVersion 34
        versionCode 1
        versionName "1.0.0"
        multiDexEnabled true
    }

    signingConfigs {

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

    }

    buildTypes {
        release {
            debuggable false
            signingConfig signingConfigs.release
            // Enables code shrinking, obfuscation, and optimization for only
            // your project's release build type. Make sure to use a build
            // variant with `debuggable false`.
            minifyEnabled true
            // Enables resource shrinking, which is performed by the
            // Android Gradle plugin.
            shrinkResources true
        }
    }
}

flutter {
    source '../..'
}

dependencies {}
huycozy commented 1 month ago

Thanks for the update. Could you share your device info (OS, model)? Also, please share the output of flutter doctor -v. It seems they are not connected properly.

To make this more clearly, could you please share:

BrillianceOsprey commented 1 month ago

Vivo Android version 14 Also on Samsunge s34 ultra Android version 14

''' ➜ ~ flutter doctor -v
[✓] Flutter (Channel stable, 3.19.3, on macOS 14.3.1 23D60 darwin-arm64, locale en-TH) • Flutter version 3.19.3 on channel stable at /Users/admin/SDK/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ba39319843 (11 days ago), 2024-03-07 15:22:21 -0600 • Engine revision 2e4ba9c6fb • Dart version 3.3.1 • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/admin/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.15.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.87.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.84.0

[✓] Connected device (4 available) • M2101K9AG (mobile) • 8dedb6bb • android-arm64 • Android 13 (API 33) • iPhone 15 Pro Max (mobile) • 8ACE47C6-3413-4D6F-BFA5-FC498F3DC5C2 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.3.1 23D60 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.112 ! Error: Browsing on the local area network for HHA1157. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources • All expected network resources are available.

• No issues found!

'''

Sometime it works on debugging with cable , in debugging case(it taking too long and noting happen) Actually happening (in both debug and release modes) Does this issue occur on a newly created Flutter project that doesn't have any 3rd plugins/packages (Yes, but it is working with in first run i got isn't compatible massage)

huycozy commented 1 month ago

Sometime it works on debugging with cable , in debugging case

It also means the issue still occurs when you debug the app with plugged devices, right? We need to catch the error from the output console if any. I would suggest you observe it and notice if there is any pattern.

Yes, but it is working with in first run i got isn't compatible massage

I don't see the issue on my end with a newly created Flutter project on Android 14 device (Pixel 7).

! Error: Browsing on the local area network for HHA1157. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.

Looking at this error from your flutter doctor output, I think there is something wrong with device connection. Could you share the output of flutter devices?

BrillianceOsprey commented 1 month ago

But, I didn't use that device HAA1157 ''' flutter devices Found 3 connected devices: iPhone 15 Pro Max (mobile) • 8ACE47C6-3413-4D6F-BFA5-FC498F3DC5C2 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator) macOS (desktop) • macos • darwin-arm64 • macOS 14.3.1 23D60 darwin-arm64 Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.112

No wireless devices were found.

Error: Browsing on the local area network for HHA1157. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27)

Run "flutter emulators" to list and start any available device emulators.

If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips. '''

huycozy commented 1 month ago

Maybe there are some additional configurations on your AndroidManifest.xml file as well. Since you said the issue also occurs on a newly created Flutter project, could you share the project on your end so that I can try running it?

BrillianceOsprey commented 1 month ago

Yes, i can that is new apk thtat made from flutter create new_app in this latest app still showing (This app isn't compatible with the latest version of Android.) https://github.com/BrillianceOsprey/androi_14.git

huycozy commented 1 month ago

I pulled your sample project and built apk (flutter build apk), then installed it on my device Pixel 7, Android 14 but there is no issue. The app can be opened and run normally.

It could be a device-specific issue. Could you check this with an Android native project?

BrillianceOsprey commented 1 month ago

Yes i tried with Kotlin it ok don't show me that alert dialog Please can you try other brand except from Pixel

On Wed, 27 Mar 2024, 11:02 am huycozy, @.***> wrote:

I pulled your sample project and built apk (flutter build apk), then installed it on my device Pixel 7, Android 14 but there is no issue. The app can be opened and run normally.

It could be a device-specific issue. Could you check this with an Android native project?

— Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/145197#issuecomment-2021907578, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANQL6KBPRQQKJHM4M4MVOVTY2JDVJAVCNFSM6AAAAABEXM3DDSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRRHEYDONJXHA . You are receiving this because you were mentioned.Message ID: @.***>

huycozy commented 1 month ago

Issue also doesn't occur on Galaxy Tab A7 Lite (Android 14):

Demo ![Screenshot 2024-03-28 at 11 36 16](https://github.com/flutter/flutter/assets/104349824/8989580e-0731-4ac7-a2e2-da7352591321) ![Screenshot 2024-03-28 at 11 36 21](https://github.com/flutter/flutter/assets/104349824/f7fc708c-44ff-4cdd-99ca-c1807dfd07b9)

Could you check this to see if it helps?

BrillianceOsprey commented 1 month ago

flutter build apk --split-per-abi --no-tree-shake-icons I did build with this command and that errors occur only on real devices for emulator i did build flutter build apk it is working

huycozy commented 1 month ago

flutter build apk --split-per-abi --no-tree-shake-icons

It will generate different apks so you should install the applicable one to your device’s architecture.

What if you build with flutter build apk? Does the issue occur on your device in this case?

github-actions[bot] commented 1 week ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.