Jacob Brasil
Jacob Brasil

Reputation: 125

Flutter build for plugin fails, class file not found

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!

Upvotes: 3

Views: 1074

Answers (1)

Niraj
Niraj

Reputation: 973

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'

Upvotes: 4

Related Questions