jonataslaw / VideoCompress

Compress videos, remove audio, manipulate thumbnails, and make your video compatible with all platforms through this lightweight and efficient library.
MIT License
227 stars 262 forks source link

Can't build the app for Android while using the package: failed for task ':app:checkDebugAarMetadata' #207

Open AmmarMohamed21 opened 1 year ago

AmmarMohamed21 commented 1 year ago

I am on the latest version video_compress: ^3.1.2 I received the following error while trying to build flutter app for Android on Android Studio because of the package video_compress When I remove the package from the app the app is built fine, when I add it the following error appears and the app fails to build

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.otaliastudios:transcoder:0.9.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom
       - https://repo.maven.apache.org/maven2/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom
       - https://storage.googleapis.com/download.flutter.io/com/otaliastudios/transcoder/0.9.1/transcoder-0.9.1.pom
     Required by:
         project :app > project :video_compress

I tried flutter clean flutter pub cache repair and also deleting pubspec.lock .. still the problem isn't solved

Here is the result of flutter doctor

[√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.22621.819], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.73.1)
[√] VS Code, 64-bit edition (version 1.64.1)
[√] Connected device (4 available)
[√] HTTP Host Availability
shyam1s15 commented 1 year ago

did you found the solution?

Iamkrishnaa commented 1 year ago

Getting the same issue after upgrade

AmmarMohamed21 commented 1 year ago

@shyam1s15 @Iamkrishnaa I found a temporary solution somehow after reading this

I added this line in project level build.gradle and it worked

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://plugins.gradle.org/m2/" } //Added this line
    }
}

Still don't know what is the problem I believe it's maven servers down, but adding this line solved it

shyam1s15 commented 1 year ago

nope, still there I think there is a maven dependency named transcoder which is not being found, do you know how to install it in flutter app

himanshudeveloper commented 1 year ago

also i face same issue with new project

Iamkrishnaa commented 1 year ago

Better stay with v3.1.1 until the issue resolved.

himanshudeveloper commented 1 year ago

after add this maven { url "https://plugins.gradle.org/m2/" } restart vs code / android studio . it is working for me.

dustinest commented 1 year ago

Looks like the version does not exist https://mvnrepository.com/artifact/com.otaliastudios/transcoder the oldest one is 0.10.0

Technorocker commented 1 year ago

I just went to build my app to debug and I cant now either. The build fails, I added that maven line but it didnt help.

waqas6692 commented 1 year ago

add jcenter() in build.gradle (android level) under maven()

ALKESHSHARMA24 commented 1 year ago

Hey My issue is resolved i added jcenter() in build.greadle under the all projects{ repositories{ google() mavenCentral() jcenter() // Add new maven { url "https://plugins.gradle.org/m2/" } .. }

also in the buildscript { .. repositories { google() jcenter() // Add new mavenCentral() .. }

omokehinde commented 1 year ago

Add jcenter() to your build.gradle file:

allprojects { repositories { google() mavenCentral() jcenter() // add } }

RiyaSingh245 commented 1 year ago

In your android level build.gradle file:

Add jcenter(), it worked for me. As shown below. Add this to allprojects -> repositories

allprojects { repositories { google() mavenCentral() jcenter() // added } }

deissibelle commented 1 year ago

FAILURE: Build failed with an exception.

JonasJW commented 1 year ago

Still having the same issue, noting above seems to fix it

musfique113 commented 1 year ago

adding this

maven { url "https://plugins.gradle.org/m2/" }

to project level android/build.gradle solved my problem

worldwin919 commented 1 year ago

still having the same issue even after adding maven{...} and jcenter() also

Kushal25Gupta commented 1 year ago

i am using latest gradle version, kotlin version and android studio version plus i am using java latest version so when i use this package i am getting this error :

A problem occurred configuring project ':video_compress'.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

 If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

while i am using namespace in app.build.gradle, here is my android code in app.build.gradle

android { namespace "com.kushalgupta.tiktok" compileSdkVersion 33 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 {
   applicationId "com.kushalgupta.tiktok"
    // 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 23
    //noinspection OldTargetApi
    targetSdkVersion 33
    versionCode 1
    versionName "1.0"
    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
    }
}

}

So could anyone tell me how to solve it, it is only occuring when i use video_compressor, and i have tried all the above solution it doesn't work for me

dittombek commented 11 months ago

i am using latest gradle version, kotlin version and android studio version plus i am using java latest version so when i use this package i am getting this error :

A problem occurred configuring project ':video_compress'.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

 If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

while i am using namespace in app.build.gradle, here is my android code in app.build.gradle

android { namespace "com.kushalgupta.tiktok" compileSdkVersion 33 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 {
   applicationId "com.kushalgupta.tiktok"
    // 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 23
    //noinspection OldTargetApi
    targetSdkVersion 33
    versionCode 1
    versionName "1.0"
    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
    }
}

}

So could anyone tell me how to solve it, it is only occuring when i use video_compressor, and i have tried all the above solution it doesn't work for me

I have same problem with you, i resolve it by downgrade just the Android Gridle Plugin Version 8.1.2 to 7.4.2.

Before, my version is Android Gradle Plugin Version : 8.1.2 and Gradle Version : 8.4

Open your project in android studio:

  1. file > project structure
  2. menu side choose 'Project'
  3. on Android Gradle Plugin Version, click white small button on the right side or shortkey shift + enter
  4. will popup extract variable, change 'value' to 7.4.2
  5. ok > apply then, ok
Med-Amine-AB commented 11 months ago

hi just use video_compress_plus and put 21 in the min version in the android/app/build.Gradle

rignaneseleo commented 1 month ago

I fixed this problem by updating to 3.2.3

GeekAbdelouahed commented 1 month ago

Upgrading to the latest version 3.1.3 solved the issue on my side.

wildsurfer commented 1 month ago

3.1.3 fixed my problem. Thanks