2

A few months ago I've started a flutter plugin project. Its Android native code uses some precompiled third party libraries (.aar files). When building the example app in debug mode everything works fine. However, when switching to release, build fails with errors like:

  • "cannot find symbol class xxxxx".
  • "cannot find symbol method yyyyy".
  • "cannot find symbol variable zzzzz".
  • "method does not override or implement a method from a supertype".

These errors are in the java classes of my plugin. The missing symbols are in one of the third party .aar files. So it looks like the compiler does not use the .aar libraries when building the example in release configuration. Do you have any ideas how to fix this?

.

The .aar files have been added by:

  1. Creating a folder for the library at ./example/android/some-library And placing some-library.aar into it.

  2. Creating a build.gradle file alongside the .aar file. It's content looks like:

     configurations.maybeCreate("default")
    
     artifacts.add("default", file('some-library-release.aar'))
    
  3. Added the following line at the beginning of ./example/android/settings.gradle:

    include ':some-library-release'
    
  4. Added the library as a depencency at ./android/build.gradle:

     android {
         ...
         dependencies {
             implementation project(":some-library-release")
             ...
         }
     }
    
     dependencies {
         implementation project(path: ':some-library-release')
     }
    

It builds nicely in debug, but fails in release. Do you have any ideas how to fix it?

SePröbläm
  • 5,142
  • 6
  • 31
  • 45
  • Try going through the steps presented here: https://github.com/flutter/flutter/issues/59427 – Razvan S. Jan 29 '21 at 16:31
  • @RazvanS. Thanks for sharing, unfortunately it's unrelated. The issue here is that compilation in release mode fails - most likely because something is wrong in the build scripts... – SePröbläm Jan 29 '21 at 16:55

0 Answers0