Android Studio / Gradle 2.2.0 building old sources? - android

I've a problem building my app in Android Studio. It is just a small app (about 35 classes) with now modules and with only a few library dependencies. But Android Studio or Gradle often seems to build old sources.
For example now I added a simple line Log.i(TAG, "var: " + var). But I don't get this output. I tried to clean the project and then run it again but still there is no log-output. After cleaning and running once again I get this message:
10/07 09:27:11: Launching app
The APK file <path-to-file>/<file>.apk does not exist on disk.
Error while Installing APK
I know I maybe can solve this buy uninstalling the app first and building it again and/or even by clicking "refresh all gradle projects" but I don't want to do that all the time. I only have this problem for about 2 months now. But it appears very irregural.
I am using the following versions now:
macOS Sierra Version 10.12
Android studio 2.2 Buikd #AI-145.3276617, built on September 15, 2016 (JRE: 1.8.0_76-release-b03 x86_64)
java version "1.8.0_102", Java(TM) SE Runtime Environment (build 1.8.0_102-b14), Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode
Gradle 2.2.0
But this problem also appeared in another app on another system, too. There I used El Capitan and a beta version of Android Studio 2.1.
So what can I do?
Btw. I never used InstantRun. So this is definitely disabled.

Related

Android Studio Crash on Code autocomplete

Android Studio Crashing after press "Ctrl + Space"
System Config - macOs Catalina 10.15 Beta
Android Studio - 3.4.1 and 3.5 Beta 5
I have already tried
Invalidate Caches/Restart
A workout around is to add -Dsun.font.layoutengine=icu to the VM options.
Which you can do via Help > Edit Custom VM Options.
Source: https://youtrack.jetbrains.com/issue/JBR-1639
Yes there is issue in All intellij IDE causing crashes on Mac Os Catalina Beta 2, From the logs I see that IDE crash because of OpenJDK, Android Studio was working fine on Mac Os Catalina Beta 1, but started crashes on Beta 2, I downgraded back to Mac Os Mojave because it was impacting my production machine, I learn that never use Beta on Production machine. I advice you to downgrade your Mac Os to stable version. Or wait for intellij to update their apps to support Catalina.
You can go to /Applications folder and right click on Android Studio then select Show Package Contents , Goto to Contents/bin/studio.vmoptions and add at the end of the file :
-Dsun.font.layoutengine=icu
Restart the IDE.
Switching IDE java runtime to Oracle JDK 8 worked for me. To switch the IDE Java runtime:
Install "JB SDK Bintray Downloader" plugin (screenshot) in Android Studio
Follow the instructions under All platforms: switch between installed runtimes section to change the IDE java runtime - instructions
I've been using it for 2 hours now and no crash, no slow-ness, etc.
enter image description here
1) Update your Macbook OS to get latest in my case it was : 10.15.3

Android SDK cannot be found after every gradle sync

I have been facing this issue for 2 days that Android SDK cannot be found after I sync the gradle files, I have to close project and remove from the recent projects and re-open it, I don't remember what I updated or what I changed recently.
And yes, I have already tried invalidate caches and restart, clearing gradle cache etc.
System Specs:
Android Studio 3.1.3
Build #AI-173.4819257, built on June 4, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13.5
Thanks in advance.
First rebuild the app. might this has a good result
And remember don't use many countries IP like Iran because Android Studio Boycott this country. And thus connect to Vpn and Then Clean And Build project.
this ways might help you

difference between android gradle plugin and gradle

Android Studio 3.2 Canary 5
Build #AI-173.4630681, built on March 3, 2018
JRE: 1.8.0_152-release-1136-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.4-300.fc27.x86_64
I have just started a new project and when I sync'd I got this dialog box.
I am just wondering what is the difference between the Android Gradle Project and Gradle.
How would I upgrade to Gradle to version 4.5?
What is the purpose of both of these?
Many thanks in advance
Gradle is the build system.
You can use it with a lot of plugins. One of these is the Android Gradle plugin.
It is used to provide processes and configurable settings that are specific to building and testing Android applications.
Even if you have written the same java source code for a java project and android project, the way they are built and executed completely differs from each other.
Java project sources compiles to byte codes (.class files) and runs on JVM (java virtual machine).
Android project sources compiles to Dalvik byte codes (.dex files) and runs on DVM (Dalvik Virtual Machine). And both of these virtual machine have different ways of executing commands.
Android projects have many platform specific steps when building application that standard Java applications does not have. (like packaging as apk, automatic signing, project flavors management, minimum API level) With the addition of Android Gradle plugin these differences can be applied more easily and in a more refined way. (So building Android apps becomes easier for everyone).
The Android Studio build system is based on Gradle, and the Android plugin for Gradle adds several features that are specific to building Android apps. Although the Android plugin is typically updated in lock-step with Android Studio, the plugin (and the rest of the Gradle system) can run independent of Android Studio and be updated separately.
From the Docs
https://developer.android.com/studio/releases/gradle-plugin.html

Cannot start new project with Android Studio

I just started using Linux Ubuntu, and downloaded and maybe set up Android Studio.
When I launch it, it does successfully, though it took hours to come here. But it gives me now :
Your Android SDK is missing, out of date, or is missing templates. Please ensure you are using SDK version 22 or later. You can configure your SDK via Configure | Project Defaults | Project Structure | SDKs
I tried to do so and at SDKs I added Android SDK. But when I clicked "ok", the prompt was dismissed but nothing happened, that is, not added.
I tried "Android SDK" two items below SDKs, because Android SDK was empty. But this time, Apply button and OK button doesn't respond. When I look at command line at the moment this error was being displayed.
[ 550663] ERROR - llij.ide.plugins.PluginManager - Android Studio (Preview) 0.4.6 Build #AI-133.1028713
[ 550663] ERROR - llij.ide.plugins.PluginManager - JDK: 1.8.0_05
[ 550663] ERROR - llij.ide.plugins.PluginManager - VM: Java HotSpot(TM) 64-Bit Server VM
[ 550664] ERROR - llij.ide.plugins.PluginManager - Vendor: Oracle Corporation
[ 550670] ERROR - llij.ide.plugins.PluginManager - OS: Linux
It looks like there isn't relavant answer to this. All the questions tend to end with concluding "That's easy. Go Config, project default, project structure, and add Android SDK and Voila! You're good to go." Unfortunately no voila to me, so I here post this.
If anyone has an idea.
I have fix this ishue on Ubuntu 14.04, Android Studio 0.8 ::
sudo chmod 775 -R {your path}/android-studio/
In my case Studio were placed in /usr/local/android-studio ::
/usr/local/android-studio/android-studio/
I'm using Android Studio 5.7 and jdk 7 in Ubuntu 14.04 without problems.
I'm not expert but i thought you was using an old android studio version and a new jdk version.
I searched:
You are using android studio 0.4.6 based on IntelliJ 13.0
http://tools.android.com/recent/androidstudio050released
And IntelliJ adds support for JDK 8 in 13.1 version
http://blog.jetbrains.com/idea/2014/03/intellij-idea-13-1-released/
So try to upgrade Android Studio to 5.0 (based on 13.1) or better downgrade JDK version to 7 if you dont need it, perhaps not completely supported.
I was having a similar issue but on a clean install of Ubuntu 14.04, a fresh download of Android Studio 0.5.7, Oracle Java 8, Gradle 1.12 and the Android ADT Bundle 20140321. Every time I tried to bring up the Project Defaults to set the Android SDK location an exception appeared on the console with the same message you posted.
Before starting I set the various tool HOME environment variables to where those tools were installed, (which could be optional if you're installing all of these through the Ubuntu package manager..)
export GRADLE_HOME=/opt/DEV/gradle
export JAVA_HOME=/opt/DEV/jdk
export ANDROID_HOME=/opt/DEV/adt-bundle-linux-x86_64-20140321/sdk
export PATH=$PATH:$GRADLE_HOME/bin:$JAVA_HOME/bin:$ANDROID_HOME/tools
Then,
From the quick start dialog (presented when you first open Android Studio if you don't have a project already created) disable the Android Plugins found under Configure -> Plugins. Also disable any plugins Android Studio recommends when you disable the Android ones.
Restart Android Studio when prompted.
Add the Java JDK via Configure -> Project Defaults -> Project Structure -> Platform Settings: SDKs
Apply changes, head back into Configure -> Plugins and re-enable the Android Plugins.
Restart Android Studio when prompted.
Set the Android SDK Location and JDK Location under Configure -> Project Defaults -> Project Structure. When I did it, it was pre-filled so I just hit Apply.
Restart Android Studio
The SDK Manager is now a visible button under Configure and you can now create a new Android Project.
Upon creating a new Android Project, Android Studio then went off and download the various dependencies and Gradle 1.10. Annoying that it downloaded Gradle again, but at least Android Studio started to work after that.

Android Studio fails - unsupport unsupported major minor version 51.0

Until yesterday my Android Studio was working fine and helping me to create Applications. But today, it started giving Gradle error error stating unsupport major minor version 51.0 and asking me to configue gradle.
I get the same error if I try to import the project back.
My java version is 7 and older Android projects in the Android studio work properly.
$ /usr/bin/java -version
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=utf8
java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) 64-Bit Server VM
(build 23.3-b01, mixed mode)
How do I solve my gradle problem with android-studio?
Last night Google team pushed version 0.7.2 of the Gradle plugin.
This version requires Java7. This is a mistake.
The plugin 0.7.3 will fix it.
You can switch back from 0.7.+ to 0.7.1 in your plugin, until 0.7.3 will be available from Maven Central.
dependencies {
classpath 'com.android.tools.build:gradle:0.7.1'
}

Categories

Resources