Flutter build for plugin fails, class file not found
160
Are you using implementation for adding any dependency?
If yes, try replacing it with api. Not sure but it worked for me.
Example:
Replace
implementation 'com.github.niraj-prajapati:UPIPayments:1.1.4'
with
api 'com.github.niraj-prajapati:UPIPayments:1.1.4'
Author by
Jacob Brasil
Updated on December 30, 2022Comments
-
Jacob Brasil 5 monthsI'm developing a plugin using Snapchat's SDK, it runs fine on iOS, however when compiling and running on Android I keep getting an error:
/Users/jnbra/Projects/snapkit/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:17: error: cannot access LoginStateController flutterEngine.getPlugins().add(new com.jacobbrasil.snapkit.SnapkitPlugin()); ^ class file for com.snapchat.kit.sdk.core.controller.LoginStateController not found 1 error FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details.The class is accessible and downloaded and I can view the source code for it in Android Studio. I've tried changing SDK versions, clearing my Gradle cache, and a few others but any help would be greatly appreciated, thanks!
-
Zaid Zakir almost 2 yearsHi,Have you tried to file ->Invalidate/cache and restart and then rebuild project,in android studio? Sometimes this error occurs when project has not detected the new resource. -
BlackPearl over 1 yearWere you able to get any solution? -
AGHA over 1 yearAny update about this?
-
-
a7md0 about 1 yearDoes this apply to local AAR files too? I have it asimplementation(name:'package_name', ext:'aar')but facing the same issue in the question -
Niraj about 1 year@a7md0 , not sure about.aarfile. but.jarcan be used same wayapi files('libs/jarFileName.jar'). You can try replacingimplementationwithapiand let me know if it helps. Till the time i'll also be checking when i get some time. -
a7md0 about 1 yearIt's working perfectly, thank you. For reference it'sapi(name:'package_name', ext:'aar')now