Does Android Studio automatically build before running? - android

When I add a line of code such as:
println(1)
Then run the app, sometimes this line of code doesn't seem to take effect.
I found that Android Studio will not build before running? How should this problem be solved?
I've tried setting Build in launch before in Edit Configure, but it fails every time with various errors, while when I manually build again it succeeds.

Related

Android studio not executing latest code

I have done some modifications to my code which upon running, Android studio behaves exactly the way it was before my changes.
As I place debug points on those new lines, I get a weird error message stating "No executable code found at line xx"
Following is a snapshot of the same. How do I resolve this issue ?
Edit: I have already tried Invalidate caches and restart, still stands unresolved.
I faced the same problem. It possible caused by AndroidStudio's new feature Instant Run. Try to stop current app, hit build->rebuild project then run app again.

Android Studio stuck while building application

I recently switched from Eclipse to Android Studio because I read that it is now the official IDE for Android application development. I downloaded and installed the latest version (1.0.2) for Windows. When using the program for the first time, I decided to create a test application to see if the program was working correctly. Unfortunately, it was not. Once I clicked the finish button to complete the New Project Wizard, A loading bar showed up that said Gradle: Build. This is where the program gets stuck. There is no error message and it appears that the program is running fine, however the build never actually completes. I am never given my MainActivity.Java class, or my activitymain.xml document. If I click the cancel button, the program freezes and I have to use the TaskManager to kill the program. If I re-enter the program and choose to open an existing project, my project will be there. However, upon trying to open the project, I am greeted with the same Gradle: Build loading bar.. I have been searching for an answer for the last 3 days and nothing has worked. Any help is greatly appreciated!
Things I have tried:
Simply letting the program sit for a while to see if it was actually downloading something and was just really slow. I let it sit for 45+ minutes before killing the program.
Uninstalling and re-installing Android Studio
Restarting my computer
Turning off my firewall (Kaspersky)
Running the program as an administrator
Connecting to a different network
Disconnecting my computer from any networks (to force the program to build in offline mode)
Manually downloading Gradle from the link that Android Studio attempts to use when it gets stuck and telling the program to use that file instead of downloading another one.
(I went to this link https://services.gradle.org/distributions/gradle-2.2.1-all.zip, downloaded the file, unzipped it, went to Gradle settings in Android Studio, checked the Offline work checkbox, and finally set the service directory path to my unzipped Gradle folder.)
Hopefully I have given enough information and made it clear what my problem is. If not please tell me what else I need to explain so I can get this issue resolved. Thanks!
Please note I am working on a 64 bit machine running Windows 8. Also, I use studio64.exe
to run the program.
From the discussion we had in the comments, it does not look like you have your gradle on your windows path.
Please change the below to point to your gradle install:
set GRADLE_HOME=C:\<installation location>\gradle-1.11
set PATH=%PATH%;%GRADLE_HOME%\bin
After this, verify that in the terminal running the following works:
gradle tasks
once you get this working, you will want to run the following in your project:
gradle wrapper
This will produce a .bat file which you can then use to run gradle through the wrapper, letting you support multiple native gradle installations.

Android sendBroadcastAsUser() UserHandle.USER_CURRENT error

I am rebuilding an Android app for which I've the source code from the OEM. Normally, the app can be using the make command in command line and that works. The app's UI, manifest etc. is done in Eclipse. But Eclipse can't compile the app, and gives error on the line shown below and does't recognize the item USER_CURRENT.
sendBroadcastAsUser(exampleIntent, new UserHandle(UserHandle.USER_CURRENT));
Does anyone know how can I build and run the app from Eclipse?
Btw, I build my own system image for the platform using Android 4.4.2.
Thanks.
I used
android.os.Process.myUserHandle()
to get UserHandle instance.

Gradle 'configuring projects' never ends

Clean install of Android Studio 0.8. I create a new project with a blank activity and it will not let me run the app because there appears to be a gradle task still running. All it says is "Gradle: Configure projects" in the status bar of Android Studio and it just sits there. I'm not sure what's wrong but I've been trying to get an android dev environment setup on a couple of machines now and consistently hit this same problem.

android studio build error debug-unaligned.apk path not found

Last night I updated my android studio to 0.5.3 and since than i am getting this error message whenever I am trying to generate a signed-apk. It does not occur when I am just running the project over android studio.
I tried rebuilding, cleaning project, restarting android-studio, reimporting the project, no success. I am pretty desperate right now
EDIT: i found out that actually debug-unaligned is not generated... But why is that? And why do i need to generate it if i am just trying to sign the app
In 0.5.3, we tried to speed up the build process by not having it do a full build to an APK except when it needs to, but we missed some cases where it needs to.
You can follow progress in https://code.google.com/p/android/issues/detail?id=67948 but in the meantime you can work around it by running the assembleRelease task, either from the command line or from the Gradle tasks view:

Categories

Resources