Flutter not building app without error at all - android-studio

My Flutter project was working just fine. I lost my Internet connection for a bit and when it came back I got a pop up talking about an Android Configuration found for the project, I clicked Add, then it started showing me two Device slots on the Upper tab where it shows what devices are connected.
Now if I need to run my app on my device, Flutter simply tries to run the project, then stops without any output in the Run Tab of Android Studio. This is really giving me a headache... I wish it gave an error or something. Someone please help me so i can resume development.

if you have not changed anything in the android directory the easiest thing to do is to delete it, then run in the terminal
flutter create .
if you have changed a lot of things in the android you can copy your changes and do the same or can go an revert the gradle configurations manually.

Related

Show correct Bubble in Android Studio when nothing has been deployed

I repeatedly run into the problem, that Android Studio is not deploying the app on the mobile device.
When I hit the play button it shows the following message in the 'Run'-Tab:
02/16 12:08:06: Launching 'App' on Physical Device.
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant: debug
Normally, I can fix this by hitting the "Sync project with gradle files"-Button or just trying to deploy again. So this is not the main problem.
The annoying part is, that Android Studio shows the green "Success. Operation succeeded"-Bubble next to the run tab, even if nothing was deployed to the device.
Is this a problem in the IDE? Can it somehow be configured to show an error instead?
I am using Android Studio 4.1.2
run -> edit configuration -> before launch
click on add button and select gradle-aware make
then press apply and then OK
by above step my app run successful

android studio 3.1.1 not reflecting changes in apk

I have read at least 5 responses to this but none has worked so far... In windows 10, Android studio 3.1.1 (the latestest version, april 2018) I have an app which I have made some changes in but that changes do not deploy in the AVD. The bugs listed that it's supposed to have been corrected for this version persist, and none of the solutions for this problem I have found worked. Could anyone Help me solve this somehow? I have spent days in this... Thanks.
By the way, the app I have to modify is in react-native.
Firstly, please try cleaning your project and building the app. To achieve this, please click in menu bar Build and choose Clean project. Then go to Build tab again and click Rebuild project.
Also, please try to restart your AVD.
Optionally, go into settings of your AVD and uninstall your app manually. Then click play button and choose your AVD to run your app on this AVD.
If the problem persist please provide more info. Especially please give us more info if you are using gradle build tools, if yes then what info does the gradle console give you, etc.
Ok, if you are sure none of above work, please tell me if your changes are reflected on another, possibly new AVD?
Do you have a chance to try your app on real device connected to your computer in debug mode (Developer Tools active, computer trusted and usb debugging allowed)? Do you see changes in your app on device?
Let's give another try to something like this: please open build.gradle file, then make some slight change in it (like add some space). Android Studio should notice change in gradle file so it will prompt you with yellow bar above with option: Sync Now. Does your app reflect changes after that?
And lastly, are you sure your changes are not reflected? Can you add something logging to Logcat (i.e. Log.d("test", "this should print in logcat debug level.."); ).
Another edit, have you tried this?
Open MainApplication.java in the android/app/src/main/java/{packagename} directory, delete the following code if exist:
import com.facebook.react.BuildConfig;

Logcat is not showing anything on android studio

So I am using an emulator and logcat is empty, even my custom logs are not coming up, however if I navigate to the terminal in Android studio I can see that it's looking at my project folder instead of android-sdk/platform-tools where the adb.exe is.
When I use that terminal to navigate there and run adb logcat I can see the log fine.
Could that be the reason why the logcat is not working? And if it is how can I fix that?
I am also sure that I have logcat pointed to the correct device & project.
Thanks.
I recall that if you are in Windows some external scripts fail if your full path to adb.exe contains a space. Make sure you have your adb in a directory that has no space. For example:
This is my original adb location C:\Users\Mark A\sdk\platform-tools\adb.exe
I transferred all my folder to a new folder with no spaces and recsynched everything to make it work.
Am not sure this is your issue but it may help others.
Good luck.
I'm not sure if this will help you at all, but it's something I ran into recently after upgrading to Android Studio 1.5 that took me hours to resolve.
Because I'm sharing common code between android and non-android, I wrote my own logging interface and more than one implementation.
In the android implementation, I used "" as a tag. This wasn't a problem before I upgraded to Android Studio 1.5, messages would show up as:
I/ debugging message
However, after upgrading to Android Studio 1.5, I could still see system log messages but all my own log messages were gone.
Finally it occurred to me that perhaps now an empty tag is no longer supported and sure enough, once I added in tags that were not empty strings my debugging messages returned.
Make sure that you already choose device and application to see log.

Android Studio won't run application from studio ide?

I've got an application I've been working on and am having an issue with android studio. When I click "build->run" and then select my device, the application never runs on my phone (and the log in android-studio that automatically comes up does not have anything, whereas in the past when I have used this feature it usually says something like, "waiting for phone..." and then the application pops up and automatically opens on the phone and you get some other pertinent information). I have the phone already in developer mode with the install from unknown sources set to on. When I manually move the application from its gradle build location to the phone and then install it manually in file explorer, all is well and the application performs as expected. As I need to debug, however, this is not a very viable solution. Anybody have any advice as to how to get it to run from the IDE? I have tried rebuilding and invalidating the cache/restarting android studio, to no avail.
When I click the run tab at the bottom I have an empty window. When I click the debug tab, I see:
Waiting for device.
Target device: samsung-samsung_sm_g920a-randomIntegerId
Uploading file
local path: /home/eric/Documents/class/OOSE/final_project/2015-group-17/project_code/android/Place2B/app/build/outputs/apk/app-debug.apk
remote path: /data/local/tmp/oose2017.myApp
Note: I am building the application on a LUbuntu 15.04 VM on a windows 8 host, and am using the latest version of android studio.
EDIT: gradle console indicates a successful build as well (obviously since moving the .apk manually to the device works properly).
Open 'Run->Edit Configurations...', and look for your app module in the column on the left-hand side.
Select it, then go to the 'General' tab.
Under the 'Activity' section, there are a couple of radio buttons. Make sure that 'Launch default activity' is selected.

Android Studio is installing old apk on device

I am developing an Android app using Android Studio (0.89 Build #AI-135.1404660, Built on Sept 3,2014) using both emulator and Nexus 4 device.
I had the same issue with a version prior to that.
The problem is that after I changed my code and resource files, I still get the old apk installed on the device or emulator.
What do I need to do to get it to run current code? Is it a building config?
Is it a known issue with Android Studio?
Or with a Nexus 4 device?
This is the second time it has happened, and I resolved it(then) after trying one of the steps below. They have not worked for me again.
Here is what I've tried
Build > Clean Project > Restart Android Studio > Run
Build > Rebuild Project > Run
Step 1 plus Uninstalling of apk on device
Step 2 plus Unistalling of apk on device
Adding erroneous resource entry then running.
I have read the following:
Android apk install: How to clear files from old version?
adb - How to reinstall an app, without retaining the data?
Device still has the old apk
Android build doesn't update code base or resources for target .apk on device
None has worked so far.
I had the same problem. After trying numerous methods that didn't work, I realized that I had accidentally changed an option in my "Run Configuration". Here's exactly what I did to fix the issue.
Run --> Edit Configurations
With your configuration selected on the left panel (mine says "app"), in the General tab on the right panel, there is a section called "Before launch". This section should have an option added called "Gradle-aware Make", but I had accidentally removed it.
I re-added it by pressing the "+", then clicking OK in the popup (leave the input box in the popup blank).
Click apply.
This fixed the problem immediately. Hope this helps someone!
Run / Debug Configurations / Miscellaneous TAB
[] Uncheck: Skip installation if APK has not changed
Android Studio doesn't always detect small changes in code.
The behaviour is erratic. I solved it by reviewing my code.It turned out that there was a resource file that was invalid. Try reverting back to the last working version of your code before the current changes... Probably a known issue that will be/was resolved out of Beta
Google thinks it is a feature, not a bug
https://code.google.com/p/android/issues/detail?id=156263
Their proposed solution is to copy the apk(s) instead of manipulating the filename, as in e.g.
Copying APK file in Android Gradle project
I've spent way too many hours to keep this to myself. The way I fixed it was that I noticed some hours later that I was using different layout version in res/ .... I have actually two versions of layout (layout-v26) and (layout). All this time I was modifying the other one and uploading different one. Maybe its just a newbie mistake but I hope somebody will find it useful.
The reason why there are 2 version was because of " autofillHints="" -> quickfix -> create new version of layout "
image of my tree
I am using android studio for building flutter app, I was facing the same issue untill I did the following:
From Android Studio, go to Tools-Flutter-FlutterClean
It resolved my problem as of now.
Check Your Layout Files.
I ran into the same problem and I realized, it gives some problem if you have same layout in multiple orientations(portrait and landscape). If one is changed other remains unchanged and then it creates a conflict. So android studio installs the one with the previous layout
PS: This was happening in my case.
The problem occurred on my Android 11 devices. I guess ART ran old code dex2oated.
Solution:
Run / Debug Configurations - General - Always install with package manager (disable deploy optimization on Android 11 and later), and check the option.
I was also facing this issue and get solution by deleting build folder manually because some time ide cannot be able to delete this. So go to the app folder and find build folder delete this and after clean and build project and run again.
projectname->app->build
You should select "Deploy default APK" option in Run/Debug Configurations. After that Android Studio will upload and install new apk to your emulator/device when you run application.
In android studio. at right side. see gradle option. click it. and then press circular arrows button shown in red square.
Same problem, none of the solutions mentioned here had any effect. I had to disable the "Allow parallel run" in "Menu > Run > Edit configurations...".
You can read more about this option here: How to run the same project multiple times in IntelliJ IDEA?
The solution to this issue is actually very simple.
Android studio is actually not detecting some small changes that you have made to the application. That is why it is installing the previous builds.
The solution is easy -> Remove the previous builds.
In the right side, go to gradle tab.
Expand Tasks. Find "clean" or "cleanCache" task or any task that starts with "clean". Double click to run that task.
Expand "app". and do the same.
Then File> Invalidate cache and restart.
Enjoy!! Your problem is solved...
My devices also ran old states - dont know from where in my git it has taken these.
I created a new configuration (default is "app") and it worked.

Resources