Android side of a Flutter project showing error - android

I have a Flutter project where, all of a sudden, without me doing anything special as far as I can remember..the Android side has started to show an error, and I am totally lost, I have no idea at all of what is wrong or why that happened.
That is what I see when I open the android folder, the MainActivity on the flutter project on android studio:
I have tried calling flutter clean, restart/invalidate cache, gradle clean...and so far nothing works.
The weird thing is that the project actually runs in the emulator without any problem. And also, if I open the Android part independently on Android Studio i don't see any error.
Anyone had that before?
Android Studio version 3.3.1
Solutions of this answer do not work.
** ----- NOTE ----- **
The problem here can be (not sure at all maybe someone else can help here) that I am using a flutter package called ImagePicker, which after some code investigation, it turns out that it is using some AndrodX imports....and...as far as I am aware of...Flutter is not yet compatible with AndroidX.
But i need someone else to confirm that in order to post a solution.

This error is not really an error. This happens because android studio is set to read and edit dart not java. In order to edit the android side of a flutter project, you need to click on the android folder -> go to the flutter option -> click 'open in Android Studio'.
This will then allow you to edit the android side of your project.

Set Configure to the Android project SDK of flutter application
Step by Step
Click on File -> Project settings then select appropriate API level as per your project will solve your issue

Related

Gradle on adroid studio not working properly

Hello there I seriously need a help, I am a python programmer who just have started learning flutter, I have been sitting on one single error for 12 hours now.
I have tried every possible solution on the internet. I have re-installed android studio too, tried to fix xml files too. I am attaching the error below and a screenshot of my build.gradle too, please ask for more if need.
I also get this issue and in my case I found two solutions. First, rebuild the project or you can also try clean project. Second if your project is not big, you creat another fresh project and copy all codes from previous project to this new one and third but not in the list, go to settings and search gradle and then select the latest version of gradle or download it after finishing it restart the android studio with "run as administrator ". Hope it will works.

Add Android Run/Debug configuration for Flutter project

I am working with a Flutter example project where it shows how to share a FlutterView inside an Android application (and iOS also).
While working with it I tried this:
I make changes to the android project like changing the theme color, if I do hot-reload/run for main.dart I don't see the changes reflected in the running app. I have to stop it from Android Studio and run the main.dart again to see the changes.
To solve the issue I was thinking to add a run/debug configuration for Android app module. So that I could run android app and not main.dart.
Is there a way how to achieve this in Android Studio?
One solution for me was to open the android(/flutter_view/android/app) project from a new window in Android studio. I could run the app this way.
(But here I encountered another issue in case anyone has the solution).
According to my understanding you face problems when you open your project and try to run.
Android studio asks you to configure your project to be able to run...
It's easy to solve near to run button you will find "add configuration" button just press then from left side select "flutter" and put in the field "entrypoint" your main Dart file path main.dart...
EX. E:/project/lib/main.dart....
Then from top right corner press "create configuration"...
That's it.
For Configure your Flutter app on Android you have to Upgrade Gradle file..
So Go to the Tool and at you will find AGP upgrade Assistant..
It Download new Gradle file then its Config automatic..

eclipse cause Lint error when save any layout xml files

I think I'd tried everything to fix it but failed.
I've downloaded eclipse from here: http://www.eclipse.org/downloads/packages/eclipse-android-developers-includes-incubating-components/neonr
It's the latest eclipse package made to work with android app developing.
AND
I've downloaded and installed Android Sdk from:
https://dl.google.com/android/installer_r24.4.1-windows.exe
https://dl.google.com/android/android-sdk_r24.4.1-macosx.zip
That's right, both windows and mac versions.
My Android sdk looks like this.
And I created a new android application project, and I just open a pre-made layout xml file and as soon as I save a change I got this.
'Running Android Lint' has encountered a problem.
Failed
Detail:
Failed
java.lang.UnsupportedOperationException
So, here is the big question, how to fix android lint? Or at least point me the right direction, I've tried this on a PC and on a Mac, same problem.
Update: I know android studio and I've used it alot. Let's just say I have my reasons to pick up eclipse and make it work again.
It can be solved by turn off lint error check.
Click Window in Eclipse, select Preferences. Select Android -> Lint Error Checking on the left, and uncheck following checkboxes:
1.Run full error check when exporting app and abort if errors are found 2.When saving file check for error
For ref please check the screenshot I have attached:

All Java Files becomes red marked as error. but project build successfully

I am using android studio 1.0. I am developing a small android application. When i was editing the code in one of my java file in android studio, power cut happened.
After power came, i open the android studio and open my project, all files in the java folder marked as red indicationg error.
but the projects build successfully. when i sync with gradle.
it also done successfully. and perfectly runs in the device after launced the app in my phone.. but the red mark not disappear
even i close the project and reopen. If i create new project also, the same things happen again.
i can't understand what's happened. i also tried re install my jdk 1.7
Can anyone help me, how to fix this bug. please give exact solution. i don't like suggestions like to re install android studio
Try to Update to androidstudio 1.2
Close Android Studio
Go to C:\Users\user\\.AndroidStudio2.3\system\caches directory and delete all files.
Restart Android Studio
Done.

Android application giving a weird error in Eclipse

i put this question in this forum because i am not sure whether this is an eclipse error or an Android error.
yesterday i created an Android application using Google Maps and GPS on Eclipse and it build and ran successfully however today i wanted to do some modification to the code so i started eclipse but it gave me an error.
SDK parse failed
if i try to run it. it says the apk cannot find. how can that be happened? the same application ran successfully on the same environment yesterday. i am using Ubuntu 10.04
Thanks !!
There is a problem with your project, as evidenced by the red x icon on your project title bar shown in the image above. Right-click your project, choose Properties and go through all your properties to make sure they are all still valid. It might be a reference to one of the jar files.
I get this problem all the time, hopefully my solution works for you.
To work around, goto your libraries inside the properties page.
Add any library and then rebuild your project.
Go back and remove the library later for clean up.
The project should still build.

Categories

Resources