flutter_zoom_plugin icon indicating copy to clipboard operation
flutter_zoom_plugin copied to clipboard

Direct local .aar file dependencies are not supported when building an AAR.

Open praharshbhatt opened this issue 4 years ago • 12 comments

Your Environment

  • Plugin version: 0.08
  • Platform: Android
  • OS version: Microsoft Windows [Version 10.0.19041.508]
  • Flutter info (flutter doctor): Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.19041.508], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0) [√] Android Studio (version 4.0) [√] Connected device (1 available)

• No issues found!

  • Plugin config:
  flutter_zoom_plugin:
    git:
      url: git://github.com/decodedhealth/flutter_zoom_plugin.git
      # Android
      ref: 0.0.8
      # iOS
      #ref: master

Expected Behavior

Application runs

Actual Behavior

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Note: D:\Multiverse_Projects\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_secure_storage-3.3.4\android\src\main\java\com\it_nomads\fluttersecurestorage\ciphers\RSACipher18Implementation.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: D:\Multiverse_Projects\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\in_app_purchase-0.3.4+9\android\src\main\java\io\flutter\plugins\inapppurchase\MethodCallHandlerImpl.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\Multiverse_Projects\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\webview_flutter-1.0.0\android\src\main\java\io\flutter\plugins\webviewflutter\FlutterWebView.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_zoom_plugin:bundleDebugAar'.
> Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :flutter_zoom_plugin project caused this error: D:\Multiverse_Projects\Flutter\flutter\.pub-cache\git\flutter_zoom_plugin-88d1fa2685f28d67410d46e094461a0a030d3192\android\libs\commonlib\commonlib.aar, D:\Multiverse_Projects\Flutter\flutter\.pub-cache\git\flutter_zoom_plugin-88d1fa2685f28d67410d46e094461a0a030d3192\android\libs\mobilertc\mobilertc.aar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 45s
Exception: Gradle task assembleDebug failed with exit code 1

Steps to Reproduce

  1. add the dependency in pubspec (0.0.8)
  2. flutter run

praharshbhatt avatar Oct 07 '20 02:10 praharshbhatt

Any updates?

praharshbhatt avatar Oct 09 '20 03:10 praharshbhatt

@praharshbhatt I am also facing same issue ? Did you fixed the issue ? If yes, please let me know how did you fixed.

Execution failed for task ':flutter_zoom_plugin:bundleDebugAar'.

Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :flutter_zoom_plugin project caused this error: C:\Softwares\flutter.pub-cache\git\flutter_zoom_plugin-88d1fa2685f28d67410d46e094461a0a030d3192\android\libs\commonlib\commonlib.aar, C:\Softwares\flutter.pub-cache\git\flutter_zoom_plugin-88d1fa2685f28d67410d46e094461a0a030d3192\android\libs\mobilertc\mobilertc.aar

Mallikarjun7657 avatar Nov 05 '20 13:11 Mallikarjun7657

@Mallikarjun7657 Can you retry with the following configuration:

  flutter_zoom_plugin:
    git:
      url: git://github.com/decodedhealth/flutter_zoom_plugin.git
      # Android
      #ref: 0.0.8
      # iOS
      ref: master

flutter clean flutter pub cache repair flutter run

praharshbhatt avatar Nov 13 '20 04:11 praharshbhatt

Found a solution & it worked with Debug-RELEASE APK/Bundle

if you have a flutter project demo then in android module of demo --> Open build.gradle (app level) insert following code

   **Sample**
  implementation fileTree(include: '*.aar', dir: '<path to zoom-plugin-libs>') //path relative to  folder(aar files are stored) present in zoom-plugin dir

    **Example**
   implementation fileTree(include: '*.aar', dir: '../../flutter_zoom_plugin/android/libs/commonlib/')
   implementation fileTree(include: '*.aar', dir: '../../flutter_zoom_plugin/android/libs/mobilertc/')

--> Open gradle.properties insert following code

   android.enableDexingArtifactTransform=false

One last change is a suggestion to flutter-zoom-plugin, We changed a line in build.gradle of android module of this plugin :

   compileOnly files('libs/commonlib.aar') //path relative to libs folder present in zoom-plugin dir
   compileOnly files('libs/mobilertc.aar')    //path relative to libs folder present in zoom-plugin dir

Don't forget to add the proguard-rules for zoom libs/classes (if you skip it, it may not work in release APK/Bundle)

Preview for file proguard-rules.pro

  -keep class us.zoom.** { *; }
  -keep class us.zipow.** { *; }
  -keep class com.zipow.** { *; }
  -keep class org.webrtc.** { *; }
  -dontwarn us.zoom.**
  -dontwarn com.zipow.**

amaurya08 avatar Jan 09 '21 05:01 amaurya08

Found a solution & it worked with Debug-RELEASE APK/Bundle

if you have a flutter project demo then in android module of demo --> Open build.gradle (app level) insert following code

   **Sample**
  implementation fileTree(include: '*.aar', dir: '<path to zoom-plugin-libs>') //path relative to  folder(aar files are stored) present in zoom-plugin dir

    **Example**
   implementation fileTree(include: '*.aar', dir: '../../flutter_zoom_plugin/android/libs/commonlib/')
   implementation fileTree(include: '*.aar', dir: '../../flutter_zoom_plugin/android/libs/mobilertc/')

--> Open gradle.properties insert following code

   android.enableDexingArtifactTransform=false

One last change is a suggestion to flutter-zoom-plugin, We changed a line in build.gradle of android module of this plugin :

   compileOnly files('libs/commonlib.aar') //path relative to libs folder present in zoom-plugin dir
   compileOnly files('libs/mobilertc.aar')    //path relative to libs folder present in zoom-plugin dir

Don't forget to add the proguard-rules for zoom libs/classes (if you skip it, it may not work in release APK/Bundle)

Preview for file proguard-rules.pro

  -keep class us.zoom.** { *; }
  -keep class us.zipow.** { *; }
  -keep class com.zipow.** { *; }
  -keep class org.webrtc.** { *; }
  -dontwarn us.zoom.**
  -dontwarn com.zipow.**

@amaurya08 Where i need to add these lines? compileOnly files('libs/commonlib.aar') //path relative to libs folder present in zoom-plugin dir compileOnly files('libs/mobilertc.aar') //path relative to libs folder present in zoom-plugin dir

dulkith avatar Jan 29 '21 13:01 dulkith

@amaurya08 Where i need to add these lines? compileOnly files('libs/commonlib.aar') //path relative to libs folder present in zoom-plugin dir compileOnly files('libs/mobilertc.aar') //path relative to libs folder present in zoom-plugin dir

Just for the sake of making my project work, I added the zoom plugin complete folder into project root folder. Here is the screenshot for the same and for the libs folder

image

amaurya08 avatar Jan 30 '21 07:01 amaurya08

I'm facing a similar issue, but Google states:

Note: You can't use the compileOnly configuration with AAR dependencies.

Source: https://developer.android.com/studio/build/dependencies

larssn avatar Mar 30 '21 09:03 larssn

I'm facing a similar issue, but Google states:

Note: You can't use the compileOnly configuration with AAR dependencies.

Source: https://developer.android.com/studio/build/dependencies

add compileOnly in plugin's android module project level (build.gradle) file. I am using follwoing gradle configuration

`group 'com.decodedhealth.flutter_zoom_plugin' version '1.0-SNAPSHOT'

buildscript { repositories { google() jcenter() }

dependencies {
    classpath 'com.android.tools.build:gradle:3.4.0'
}

}

rootProject.allprojects { repositories { google() jcenter() } }

apply plugin: 'com.android.library'

android { compileSdkVersion 29

defaultConfig {
    minSdkVersion 21
    targetSdkVersion 29
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
lintOptions {
    disable 'InvalidPackage'
}

}

dependencies { implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.material:material:1.0.0' compileOnly files('libs/commonlib.aar') compileOnly files('libs/mobilertc.aar') } `

Here is my flutter application's project level gradle buildscript { ext.kotlin_version = '1.3.50' repositories { google() jcenter() }

dependencies {
    classpath 'com.android.tools.build:gradle:3.4.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.3.3'
}

}

allprojects { repositories { google() jcenter() } }

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

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

App level gradle

flutter { source '../..' }

dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.android.support:multidex:1.0.3' implementation fileTree(include: '*.aar', dir: '../../flutter_zoom_plugin-master/android/libs/') }

_### And it's working 🗡️ _

amaurya08 avatar Mar 30 '21 12:03 amaurya08

It is not working. I'm having the same issue. Execution failed for task ':flutter_zoom_plugin:bundleDebugAar'.

Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error).

Nishakar561 avatar Apr 17 '21 11:04 Nishakar561

any progress or solutions to this "direct local .aar file" problem?

markfili avatar Feb 14 '22 15:02 markfili

See solution posted to https://github.com/flutter/flutter/issues/28195

CarlBinneman avatar Feb 18 '22 01:02 CarlBinneman

Execution failed for task ':flutter_zoom_plugin:bundleReleaseAar'.

Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :flutter_zoom_plugin project caused this error: /home/jarves/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zoom_plugin-0.0.7/android/libs/commonlib/commonlib.aar, /home/jarves/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_zoom_plugin-0.0.7/android/libs/mobilertc/mobilertc.aar

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2m 29s

abdul-webiixx avatar Mar 04 '22 10:03 abdul-webiixx