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

Errors while building on android device #30

Closed
xyzbilal opened this issue Jan 26, 2019 · 19 comments
Closed

Errors while building on android device #30

xyzbilal opened this issue Jan 26, 2019 · 19 comments
Labels
triage Further information is requested
Milestone

Comments

@xyzbilal
Copy link

Hi, I m receiving errors while building project for android devices. I searched for the solution but no idea about it. any idea?

/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:10: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:11: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:127: error: cannot find symbol
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, permission);
^
symbol: variable ContextCompat
location: class FilePickerPlugin
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:135: error: cannot find symbol
ActivityCompat.requestPermissions(activity, perm, PERM_CODE);
^
symbol: variable ActivityCompat
location: class FilePickerPlugin

@miguelpruivo
Copy link
Owner

It seems that it can't find the plugin somehow.

Run flutter clean and then flutter build apk if it doesn't work post your logs.

@miguelpruivo miguelpruivo added the triage Further information is requested label Jan 26, 2019
@xyzbilal
Copy link
Author

hi, thank you for your concern, I did exactly what you said. It runs on ios without problem but not on android. here are the logs.

`flutter build apk
Initializing gradle... 1,3s
Resolving dependencies... 4,0s
Gradle task 'assembleRelease'...
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/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:10: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:11: error: package android.support.v4.content does not exist
import android.support.v4.content.ContextCompat;
^
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:127: error: cannot find symbol
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(activity, permission);
^
symbol: variable ContextCompat
location: class FilePickerPlugin
/Users/bilalsimsek/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.1.1/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java:135: error: cannot find symbol
ActivityCompat.requestPermissions(activity, perm, PERM_CODE);
^
symbol: variable ActivityCompat
location: class FilePickerPlugin
4 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':file_picker:compileReleaseJavaWithJavac'.

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

BUİLD FAILED in 43s
44,2s
Gradle task assembleRelease failed with exit code 1

Process finished with exit code 1.`

Here is the flutter doctor results
`flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.0.0, on Mac OS X 10.14.2 18C54, locale tr-TR)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.3)
[✓] IntelliJ IDEA Community Edition (version 2018.3.3)
[✓] VS Code (version 1.30.2)
[!] Connected device
! No devices available

! Doctor found issues in 1 category.

Process finished with exit code 0.`

@miguelpruivo
Copy link
Owner

What’s the minimum and target version of your app build.gradle?

@xyzbilal
Copy link
Author

Dear Miguel,
Problem occurs when I set true likeandroid.enableJetifier=true in gradle.properties because firebase_messaging 2.2.0 requires that. if I remove this and set firebase_messaging 2.1.0 I can successfully build the apk. it is ok for me for me to use these versions but for future I thing this problem should resolve. I m using target version 28.
I really thankfull for your effort.

@miguelpruivo
Copy link
Owner

Would you mind to try the beta branch and see if it still happens?

Replace your file picker dependency in the pubspec.yaml with:

  file_picker:
    git:
      url: https://github.com/miguelpruivo/plugins_flutter_file_picker.git
      ref: beta

@miguelpruivo
Copy link
Owner

@xyzbilal is this still happening with the solution provided?

@blaneyneil
Copy link

@miguelpruivo i was having exactly the same problem. a Flutter upgrade forced me to target sdk 28 and to set the android.enableJetifier=true in order for Firestore packages to work. your git beta solved the errors above (after i installed image_picker_modern) but i can't yet confirm that everything works because now image_cropper is broken.

@blaneyneil
Copy link

and i should note iOS builds now fail too, with:

[!] No podspec found for image_picker_modernin.symlinks/plugins/image_picker_modern/ios``

i can't tell if that's a result of the image_picker_modern package itself or whether it's missing from the beta git branch.

@xyzbilal
Copy link
Author

xyzbilal commented Feb 4, 2019

@xyzbilal is this still happening with the solution provided?

I'm sorry I was focused to finish a project. in couple of days I will try it.

@Hussain-AlBayyat
Copy link

Hey,

I would like you to know that I was facing the same problem but after trying the beta branch the error disappeared. However, now image_picker_modern is broken.

@blaneyneil
Copy link

possible to use image_picker as the dependency and not image_picker_modern? the former has already handled the androidX migration:

https://pub.dartlang.org/packages/image_picker#-changelog-tab-

@miguelpruivo
Copy link
Owner

@blaneyneil @Hussain-AlBayyat I just reverted it back to image_picker back again on beta.

Could you clean your project and see if it is working now? Thank you.

@blaneyneil
Copy link

i removed my .pub-cache and ran packages get again, cleaned, and still got this trying to build android:

The following Dart file:
/Users/neil/flutter/.pub-cache/git/plugins_flutter_file_picker-ad71c0d940e2ed271f8f1ee6c5680bd72351df33/lib/file_picker.dart
...refers, in an import, to the following library:
package:image_picker_modern/image_picker_modern.dart
That library is in a package that is not known. Maybe you forgot to mention it in your pubspec.yaml file?

@miguelpruivo
Copy link
Owner

miguelpruivo commented Feb 5, 2019

@blaneyneil no, it's not there actually as you can see here and here.

Maybe try to run flutter pub get after cleaning. Seems like you've something stuck there.

@Hussain-AlBayyat
Copy link

It is working now, thank you.

@blaneyneil
Copy link

yes, this is working. thanks much. the git repo was cached so kept pulling in the old beta. and then another package broke because of androidX...

@miguelpruivo
Copy link
Owner

Good to know, I'll try to update master and Dart pub with this (and probably a few other) updates when I have sometime.

Leaving this issue open as of now so others can see it.

@miguelpruivo miguelpruivo added this to the Goals milestone Feb 7, 2019
@xyzbilal
Copy link
Author

xyzbilal commented Feb 8, 2019

Works nicely thank you for your effort.

@xyzbilal xyzbilal closed this as completed Feb 8, 2019
@miguelpruivo
Copy link
Owner

Version 1.2.0 is now out on master and Dart Pub. You can use it with file_picker: ^1.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants