Neo
Neo

Reputation: 11

Issue in creating the debug/release build for Android Flutter App

I have a code base in Flutter 3.3.5 and Dart version 2.18.2. Since last two weeks the android build isn't getting created. I last updated the build on Google PlayStore was on 25th September 2024. On some research I found that the jCenter shutdown could have caused the issue. In order to make it work, I updated build.grdle with the below code

buildscript {
    ext.kotlin_version = '1.6.0'
    repositories {
        google()
        mavenCentral()
        maven { url 'https://developer.huawei.com/repo/' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "com.newrelic.agent.android:agent-gradle-plugin:6.10.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.huawei.agconnect:agcp:1.4.1.300'
    }
}

allprojects {
    repositories {


        google()
        maven { url 'https://developer.huawei.com/repo/' }
        maven {
            url "https://jitpack.io"
        }
        maven { url = uri("https://maven.scijava.org/content/repositories/public/") }
      
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

After the above code, build is getting created, but when I am trunning on Real device/emulator it get stuck on the Spalash Screen. The log shows:

The plugin flutter_keyboard_visibility uses a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs. If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration. Launching lib\main.dart on XXXXXX in debug mode... Running Gradle task 'assembleDebug'... get manifestOutputDirectory error √ Built build\app\outputs\flutter-apk\app-debug.apk. D/FlutterLocationService( 7265): Creating service. D/FlutterLocationService( 7265): Binding to location service.

Its happening on Android 11, Android 13, real device as well as emulator in debug as well as release modes. Any help would be highly appreciated.

I am trying to find What I am doing wrong in creating the debug or release build for my Flutter App which was working fine till 25th September 2024.

Thanks

Upvotes: 0

Views: 73

Answers (1)

DevQt
DevQt

Reputation: 719

The log specified the possibility that causes the issue regarding the runtime issue you encountered.

According to the flutter_keyboard_visibility package changelog that is posted on the pub.dev site,

[6.0.0] - December 19, 2023: 5.4.3 republished as a new major version. The Android Gradle changes were breaking for some users so 5.4.3 was unpublished. Using this version may require you to update your Android Gradle version.

and

[5.1.0] - October 15, 2021: Removed Android v1 Embedding Support. If you created your Android project before Flutter 1.12 you may need to recreate or migrate. https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration

Please see this package documentation for more details: flutter_keyboard_visibility 6.0.0

Sometimes, there's no issue if you configure your build.gradle based on the requirements of Google Developer regarding the latest updates that the developer needs to adapt particularly when the updates affect their current build setup.

Now, try inspecting your installed flutter_keyboard_visibility third-party package. Consider whether the version is compatible with your Flutter project infrastructure.

I've encountered an issue before during runtime, it is about a third-party package I've been using. The package had no use at that time, so I removed the package, and then the runtime went running properly.

In some cases where the package has a major contribution to the project, try exploring alternatives or some adjustments if you suspect that the specific package causes the issues.

In addition, could you let me know if you've already removed the unused flutter_keyboard_visibility? If you don't, remove it from pubspec.yaml or go to your terminal and then execute 'flutter pub remove flutter_keyboard_visibility'.

Sometimes in other cases, it causes the build to have a conflict that halts from properly running the app, so it should be removed from the pubspec.yaml. Also, don't forget to do 'flutter clean' then rebuild your project and test if it resolves your issues.

I hope it helps :)...

Upvotes: 0

Related Questions