Flutter build fails due to Amplify_core

Viewed 531

I recently upgraded my flutter application to Android V2, and also made my code null safe.

Now when I try to run my code I get the below build error:

e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (26, 1): 
Class 'AtomicResult' is not abstract and does not implement abstract member public abstract 
fun error(p0: String, p1: String?, p2: Any?): Unit defined in 
io.flutter.plugin.common.MethodChannel.Result
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (54, 5): 
'error' overrides nothing
e: C:\flutter\.pub-cache\hosted\pub.dartlang.org\amplify_core- 
0.4.0\android\src\main\kotlin\com\amazonaws\amplify\amplify_core\AtomicResult.kt: (66, 26): 
Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':amplify_core:compileDebugKotlin'.
> 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 15s
Exception: Gradle task assembleDebug failed with exit code 1

Things I tried that did not work:

  • Clearing build and cache and restarting

  • Deleted the amplify_core-0.4.0 from the pub.dartlang.org folder and tried again

  • Initialized Amplify again and pulled the environment from the Launch Studio again

Any help would be greatly appreciated!

Thanks

2 Answers

I was able to solve this issue by changing my channel from Master to Stable.

In the next release of Amplify staying on the Master channel won't present this issue.

run this command -->>

dart pub upgrade --major-versions
Related