0

I'm having a problem building a Flutter app for Android. I've been working on this app for a while, and up until today I've been building for Android without problems. I've made no recent changes to the build setup.

I am not very familiar with fixing Android build issues (I came to Flutter as an iOS developer).

I am currently using Flutter v1.20.4, and as the error shows the app uses the RevenueCat flutter plugin purchases_flutter v1.4.3.

/Users/myusername/Desktop/Develop/flutter/.pub-cache/hosted/pub.dartlang.org/purchases_flutter-1.4.3/android/src/main/java/com/revenuecat/purchases_flutter/PurchasesFlutterPlugin.java:38: error: package kotlin does not exist
import kotlin.UninitializedPropertyAccessException;                                                                
             ^                                                                                                     
  warning: unknown enum constant DeprecationLevel.ERROR                                                              
  reason: class file for kotlin.DeprecationLevel not found                                                         

warning: unknown enum constant DeprecationLevel.ERROR                                                              

/Users/myusername/Desktop/Develop/flutter/.pub-cache/hosted/pub.dartlang.org/purchases_flutter-1.4.3/android/src/main/java/com/revenuecat/purchases_flutter/PurchasesFlutterPlugin.java:70: error: cannot find symbol
  } catch (UninitializedPropertyAccessException e) {                                                 
              ^                                                                                         
  symbol: class UninitializedPropertyAccessException                                                               

/Users/myusername/Desktop/Develop/flutter/.pub-cache/hosted/pub.dartlang.org/purchases_flutter-1.4.3/android/src/main/java/com/revenuecat/purchases_flutter/PurchasesFlutterPlugin.java:93: error: cannot find symbol
  } catch (UninitializedPropertyAccessException e) {                                                         
              ^                                                                                                 
  symbol:   class UninitializedPropertyAccessException                                                             
  location: class PurchasesFlutterPlugin                                                                           

3 errors                                                                                                           

Any thoughts would be great... thanks!

OpusGames
  • 21
  • 4
  • Kotlin can't be found for some reason. Does Android Studio complain if you open the Android project of your app? purchases_flutter has the kotlin dependency in the build.gradle so this is very weird – Cesar Apr 09 '21 at 04:24

2 Answers2

0

run in your cmd/terminal

flutter clean

then

flutter pub get

flutter pub upgrade

then

flutter run 

it should not works? problem in your purchases_flutter plugin

try with different version

or add

plugin purchases_flutter : any 

to your pubspec.yamel

Anushka Pubudu
  • 389
  • 3
  • 10
0

As suggested, I opened my Flutter project in Android Studio, which then spent several minutes online updating stuff in Android Studio. (I mostly use VS-Code as my IDE for Flutter dev, while handling iOS issues in XCode).

Once the Android Studio updating was done, I ran the Flutter Android build for my app in the Mac terminal ("flutter build appbundle --release"), the standard build call I use for Android production builds.

It now totally works, no errors. In the future, I need to access the Flutter projects through Android Studio periodically, so the Android setup can update....

OpusGames
  • 21
  • 4