flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

Android 13 Download not working,Working till android 12

Open BriceJoshy opened this issue 1 year ago • 12 comments

This is manifest file

<queries>
    <provider
        android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
        android:authorities="${applicationId}.flutter_downloader.provider"
        android:exported="false"
         android:grantUriPermissions="true">
         <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/provider_paths"/>
    </provider>
    <!-- Begin FlutterDownloader customization -->
    <!-- disable default Initializer -->
    <provider
        android:name="androidx.startup.InitializationProvider"
        android:authorities="${applicationId}.androidx-startup"
        android:exported="false"
        tools:node="merge">
        <meta-data
            android:name="androidx.work.WorkManagerInitializer"
            android:value="androidx.startup"
            tools:node="remove" />
    </provider>

    <!-- declare customized Initializer -->
    <provider
        android:name="vn.hunghd.flutterdownloader.FlutterDownloaderInitializer"
        android:authorities="${applicationId}.flutter-downloader-init"
        android:exported="false">
        <!-- changes this number to configure the maximum number of concurrent tasks -->
        <meta-data
            android:name="vn.hunghd.flutterdownloader.MAX_CONCURRENT_TASKS"
            android:value="5" />
    </provider>
    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>

This is build gradle

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

def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }

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

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

apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android { compileSdkVersion flutter.compileSdkVersion 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.example.hospital_app"
    // 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 29
    targetSdkVersion 33
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    multiDexEnabled true
}

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.debug
    }
}

}

flutter { source '../..' }

dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation platform('com.google.firebase:firebase-bom:31.2.3')

// Add the dependencies for the In-App Messaging and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-inappmessaging-display'
implementation 'com.google.firebase:firebase-analytics-ktx'

}

BriceJoshy avatar Mar 25 '23 06:03 BriceJoshy

Try background_downloader and see if it meets your needs.

781flyingdutchman avatar Mar 28 '23 03:03 781flyingdutchman

I also have this problem, the download task has been in the queue

device : pixel 4a, android 13

Flutter version 3.7.10 on channel stable

longsirhero avatar Apr 07 '23 08:04 longsirhero

i have the same problem
android 12

mohabbatta avatar May 04 '23 13:05 mohabbatta

I thought same way for android and iOS both but after 2 days of hard-work I found out that my implementation was somewhat wrong. If you provide me with your implemented code, I'll do my best to assist you in resolving any issues you may be facing.

Alvish0407 avatar May 19 '23 06:05 Alvish0407

any progress? I try it on android 13 with pixel7a also not working... we always have the problem that hasStoragePermission is set to false

ucola avatar May 22 '23 20:05 ucola

any progress? I try it on android 13 with pixel7a also not working... we always have the problem that hasStoragePermission is set to false

Set targetSdkVersion to 32

Alvish0407 avatar May 23 '23 04:05 Alvish0407

@Alvish0407 tried solution and download working now on android 13 but set target to 32 when you upload to play console need to upgrade to 33 is there a way that download working on targetSdkVersion 33 ?

adham-ashraf77 avatar May 24 '23 07:05 adham-ashraf77

@Alvish0407 tried solution and download working now on android 13 but set target to 32 when you upload to play console need to upgrade to 33 is there a way that download working on targetSdkVersion 33 ?

I have uploaded one app on play store having targetSdkVersion set to 32 though.

What error are using facing on console ? can you share ?

Alvish0407 avatar May 24 '23 07:05 Alvish0407

I think it will be problem in the neat future so I'm looking for a solution for download on api 33

adham-ashraf77 avatar May 24 '23 07:05 adham-ashraf77

I think it will be problem in the neat future so I'm looking for a solution for download on api 33

@781flyingdutchman has mentioned background_downloader above.

I haven't tried but maybe it might be what you are looking for. Let us know if you implement and make it work for 33.

Alvish0407 avatar May 24 '23 07:05 Alvish0407

Staring August 31 all Android apps uploaded to the Play store must target API 33. The background_downloader package supports API 33.

781flyingdutchman avatar Jun 15 '23 02:06 781flyingdutchman

see this solution it's work with me https://github.com/fluttercommunity/flutter_downloader/issues/866#issuecomment-1637088268

MohammedSalehelShazly avatar Jul 16 '23 13:07 MohammedSalehelShazly