12
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
/Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:9: error: cannot find symbol
import androidx.annotation.NonNull;
                          ^
  symbol:   class NonNull
  location: package androidx.annotation
/Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:10: error: cannot find symbol
import androidx.annotation.Nullable;
                          ^
  symbol:   class Nullable
  location: package androidx.annotation
/Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:253: error: cannot find symbol
          public void onFailure(@NonNull Exception e) {
                                 ^
  symbol: class NonNull
/Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:274: error: cannot find symbol
                    public Void apply(@NonNull Transaction transaction)
                                       ^
  symbol: class NonNull
/Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:272: error: cannot find symbol
                    @Nullable
                     ^
  symbol: class Nullable
/Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:503: error: cannot find symbol
                    public void onFailure(@NonNull Exception e) {
                                           ^
  symbol: class NonNull
/Users/ipatel/Documents/AAAA/FlutterSetup/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.9.0/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java:558: error: cannot find symbol
                    public void onFailure(@NonNull Exception e) {
                                           ^
  symbol: class NonNull
7 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for 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 4s
Finished with error: Gradle task assembleDebug failed with exit code 1

Don't know why Above Error found? I just try to connect device in my system and run.

Perviously I tried to run app on device by VS Code without Android Studio Installed. So I have followed https://medium.com/@aubykhan/setting-up-flutter-without-android-studio-6f7abdeb353c this tutorial and manually installed Gradle by terminal.

Below are some history of my terminal:

431 brew install gradle
432 brew cask install java
433 brew install gradle
434 flutter config --gradle-dir /usr/local/opt/gradle
435 flutter --version
436 clear
437 flutter doctor
438 sdkmanager "system-images;android-21;default;x86_64"
439 vi ~/.bash_profile
440 Open $HOME/.bash_profile

I thought issue might be is system found two path of Gradle or issue are others? Don't know but how can I figure out this issue ?

iPatel
  • 46,010
  • 16
  • 115
  • 137
  • 1
    Did you migrate https://pub.dartlang.org/packages/firebase_core#030 ? – Günter Zöchbauer Feb 09 '19 at 08:43
  • @GünterZöchbauer - Always thanks for your guidance. Now I can run App on my device but in console display 'registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)' – iPatel Feb 09 '19 at 10:13
  • 1
    I think you can ignore that. I have seen it many times but don't know how to get rid and I'm it doesn't cause issues as far as I know. – Günter Zöchbauer Feb 09 '19 at 10:17

2 Answers2

21

in android/gradle.properties add below two line. in my case solve issue using this.

android.useAndroidX=true
android.enableJetifier=true
john lee
  • 710
  • 6
  • 9
  • Just to clarify this answer, there is an official page which explains this in details https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility#not-recommended-manually-migrate-your-app – lumaks May 23 '19 at 22:18
  • did this and it doesnt helps ( – Roman Dec 11 '20 at 14:57
7

You need to migrate to AndroidX as mentioned in the Changelog of affected official plugins https://pub.dartlang.org/packages/firebase_core#030

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • how to migrate to AndroidX ? – TSR Feb 14 '19 at 13:42
  • See the link in my answer. – Günter Zöchbauer Feb 14 '19 at 13:43
  • 3
    When I go to Refactor>Migrate to AndroidX it says that No usages found in the project. Is there an alternative for flutter projects? – TSR Feb 14 '19 at 16:22
  • 1
    Did you open the `android` directory as mentioned here https://flutter.io/docs/development/packages-and-plugins/androidx-compatibility#recommended-use-android-studio-to-migrate-your-app – Günter Zöchbauer Feb 14 '19 at 16:28
  • 1
    @GünterZöchbauer, Still no working for me, please help, it's been a week!! – hysabone.com Apr 02 '19 at 13:15
  • I too get No usages Found when I try to migrate to Android X. but when I run the app, the error still exists. @BasedMusa , How did you solve it? – kumuda Aug 12 '20 at 09:52
  • When the "No usages found" message appears is because it is already migrated to AndroidX. That is not the problem. The problem is that the gradle version is not set correctly and requires update. To know how see this response: https://stackoverflow.com/a/54857699/3343339 – Alber8295 Nov 17 '20 at 16:20