Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Unresolved reference: FlutterMain #142

Closed
kay-schecker opened this issue Jan 7, 2025 · 11 comments
Closed

[Android] Unresolved reference: FlutterMain #142

kay-schecker opened this issue Jan 7, 2025 · 11 comments

Comments

@kay-schecker
Copy link

I'm unable to build the android application using the flutter version provided below. FlutterMain is deprecated

Running Gradle task 'assembleDebug'...
e: ~/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:14:24 Unresolved reference: FlutterMain
e: ~/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:21:52 Unresolved reference: Registrar
e: ~/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:76:47 Unresolved reference: getLookupKeyForAsset

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':adapty_flutter:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 14s
Error: Gradle task assembleDebug failed with exit code 1
Flutter 3.28.0-0.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 3e493a3e4d (4 weeks ago) • 2024-12-12 05:59:24 +0900
Engine • revision 2ba456fd7f
Tools • Dart 3.7.0 (build 3.7.0-209.1.beta) • DevTools 2.41.0
@kay-schecker kay-schecker changed the title Unresolved reference: FlutterMain [Android] Unresolved reference: FlutterMain Jan 7, 2025
@vladd-g
Copy link
Collaborator

vladd-g commented Jan 7, 2025

Hey @kay-schecker

Please contact our support team via [email protected], they will assist you further

@kay-schecker
Copy link
Author

Hey @kay-schecker

Please contact our support team via [email protected], they will assist you further

I have sent them a message.

@amandwivedi07
Copy link

Hey @kay-schecker are you able to solve this ?

@vladd-g
Copy link
Collaborator

vladd-g commented Jan 14, 2025

Hey @amandwivedi07 @kay-schecker, could you try switching to flutter channel stable?

The fix on the SDK side will be out soon

@amandwivedi07
Copy link

We are using 3.24.3 version of flutter and it is very much stable from last 6 months .
I am getting this error

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':adapty_flutter:generateDebugRFile'.

A failure occurred while executing com.android.build.gradle.internal.res.GenerateLibraryRFileTask$GenerateLibRFileRunnable
/Users/aman/.gradle/caches/transforms-3/f7c62005e93d2c8dca326fd6ddf316a4/transformed/androidx.fragment-r.txt

@vladd-g
Copy link
Collaborator

vladd-g commented Jan 14, 2025

@amandwivedi07 do you have exactly the same error as in the first comment? I couldn't reproduce it on my 3.24.5, but could on 3.28.0-0.1.pre on the beta channel

@amandwivedi07
Copy link

Screenshot 2025-01-14 at 2 59 30 PM I am getting this error

@akurnaz
Copy link

akurnaz commented Feb 14, 2025

Same error in stable channel. Is there any update?

e: file:///Users/alikurnaz/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:14:24 Unresolved reference: FlutterMain
e: file:///Users/alikurnaz/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:21:52 Unresolved reference: Registrar
e: file:///Users/alikurnaz/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:76:47 Unresolved reference: getLookupKeyForAsset

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':adapty_flutter:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

@x401om
Copy link
Collaborator

x401om commented Feb 14, 2025

Hi @akurnaz, the AdaptySDK, which is compatible with Flutter 3.29.0, is now in testing, and we expect it to be released soon.

@kingsglade
Copy link

kingsglade commented Feb 15, 2025

Hi All, had same error. I had just updated to Dart 3.7.0 and flutter 3.29.0 stable channel but note the additional generateDebugUnitTestStubRFile warning.

> Task :adapty_flutter:compileDebugKotlin FAILED
e: file:///Users/mark/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:14:24 Unresolved reference: FlutterMain
e: file:///Users/mark/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:21:52 Unresolved reference: Registrar
e: file:///Users/mark/.pub-cache/hosted/pub.dev/adapty_flutter-3.3.1/android/src/main/kotlin/com/adapty/flutter/AdaptyFlutterPlugin.kt:76:47 Unresolved reference: getLookupKeyForAsset

> Task :adapty_flutter:generateDebugUnitTestStubRFile
WARNING: [Processor] Library '/Users/mark/.gradle/caches/modules-2/files-2.1/androidx.media3/media3-ui/1.4.1/95308f5a6ed8f6c11afbfc321a724f0e2b81560e/media3-ui-1.4.1.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
 Example of androidX reference: 'androidx/media3/ui/PlayerNotificationManager'
 Example of support library reference: 'android/support/v4/media/session/MediaSessionCompat$Token'

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':adapty_flutter:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

Btw you're also quoting jcenter() in your build.gradle which is flagged as deprecated. I'm getting warnings to use mavenCentral()

@x401om
Copy link
Collaborator

x401om commented Feb 19, 2025

Hi all, this issue should be fixed in 3.3.2

@x401om x401om closed this as completed Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants