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 over 1 year
I'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 3 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 2 yearsWere you able to get any solution?
-
AGHA over 2 yearsAny update about this?
-
-
a7md0 about 2 yearsDoes this apply to local AAR files too? I have it as
implementation(name:'package_name', ext:'aar')
but facing the same issue in the question -
Niraj about 2 years@a7md0 , not sure about
.aar
file. but.jar
can be used same wayapi files('libs/jarFileName.jar')
. You can try replacingimplementation
withapi
and let me know if it helps. Till the time i'll also be checking when i get some time. -
a7md0 about 2 yearsIt's working perfectly, thank you. For reference it's
api(name:'package_name', ext:'aar')
now