Gradle not working after updating Android Studio - java

Gradle does not work at all, even gradle -v after updating android studio (4.3.1). I'm not pretty sure Android Studio caused this issue or not.
I installed Gradle from sdkman. The Gradle version is 6.6.1. When I run any Gradle command in terminal, the process keep running but nothing display. The path is not an issue here. Computer recognize Gradle itself.
Do you know any ideas to fix the issue?
I already uninstall/install Gradle, remove .gradle folder, restart a computer, remove cache and stuff like that...

Android Studio likes to use it's bundled JDKs and SDKs by default and change the location of it's settings every few releases. It doesn't like when you try to customize settings to your preferences, even something as trivial as choosing your own default project save location.
Currently (in version 4.2.x), I could only find gradle path in global settings, which turns out that even if you set global setting for gradle path, you would still need to configure it per project level.
So for sake of sanity, forget global settings and configure it per project level.
There are some forum discussion which suggests that android studio automatically switched kotlin compiler or java compiler from your gradle settings, but there are some conflicting articles too.
If you try to discuss it on their forum, they will tell you it's bad decision to change jdk because of compatibility reasons, won't help you much. This is based on my multiple bad experiences on their forum. Choosing your own JDK, Kotlin, build-tools etc has been active sore-point with community.
PS: Kotlin compiler settings is available in Other settings.

Related

Upgraded Android Studio... now when I try to run my apps, I get "No implementation found" for my main activity

Upgraded Android studio (stupid, right?). Now not only can I not hit alt-E, C to do a copy, but some older apps of mine, that I need to support, no longer run. These are apps that were put together with Android Studio 1.x.
First off, when I tried to compile, it demanded that I put "-keepattributes InnerClasses" in my proguard rules. Just including that in case it's some kind of hint.
The program compiles fine, but then it runs and quits instantly. Looking at Logcat, I see this:
2021-03-18 22:02:34.960 6147-6147/com.mycompany.myapp E/ycompany.myapp: No implementation found for java.lang.String com.mycompany.myapp.myappActivity.d() (tried Java_com_mycompany_myapp_myappActivity_d and Java_com_mycompany_myapp_myappActivity_d__)
Here's the weird part, though... in myactivity onCreate, I output a line of text. It gets there. That happens. It prints out ">>>>>CREATED APP<<<<<"
Can anyone explain what's happening? What do I need to do to fix this???
A lot has changed since ASs 1.x especially with the gradle / android gradle plugin. These are very finicky even after minor updates. Nevertheless you're more or less forced to update to a newer (not necessarily the newest) IDE version.
Not finding java.lang.String suggests some major incompatibility issue.
First you should check your JDK version (and ensure you have the full kit not just a JRE). Not all IDE versions work with all JDKs and again use an older one (10, 12) , not the absolute bleeding edge as the newest might not be supported (and android does not support newer java features anyway). I use JDK 12 and Ass 3.6.1.
Also check the gradle version you're using since gradle also has its incompatibilities. Remember to also inspect the contents of JAVA_HOME and GRADLE_HOME environment variables (if they exist and are used by your project) since they may override the build tool versions that are used.
Your safest bet would be to create a new empty project and copy all your sources in it. That might take less time then trying to clean the existing project, migrate the plugins, gradle and so on.
Until you fix the project setup you can disable proguard to get rid of one more hassle by setting
minifyEnabled false
in your app/ build.gradle # buildTypes # release. Note that proguard is usually disabled for debug builds.

Cannot resolve symbol "Override" on "Hello_World"

I installed Android Studio the other day to develop an app and even though it's not the first time I've used it, it's the first time I've installed it on this PC and I'm fairly new to all of it.
Problem: After installing Android Studio, I can't even make a "Hello_World" app, even the templates AS offers have a compiling error:
Where it doesn't recognize symbols like "Override". The Alt+Enter solution that offers is to Setup JDK which does nothing for all options or create annotation 'Override' which doesn't really seem like a good option.
These are both build.gradle files:
Things I've tried to fix it:
Reinstall Android Studio Multiple Times
Download JDK manually and change references.
Check Enviromental Values on system (Add JAVA_HOME and heck Path to be correct). Pretty sure both java and JDK work since in cmd I can run java and javac.
Obviously Build->Clean and File->Invalidate Cache + Restart
android.enableAapt2=false on gradle.properties
Trying to delete all java from my PC and reinstall bare minimum THEN install everything separatedly.
Install all SDK plataforms until Android KitKat.
It's worth noticing that in the past I had a lot of problems getting java to run in only one place (mainly because I install software in an HDD and have OS on another SDD).
Also, while installing AS for the first time I got into a BSOD because of VT-x having shitty interaction with virtualization of anti-virus (that took me a while to figure out) so it stopped halfway. However I've reinstalled a bunch of times so I don't know how that could matter.
The problem is very similar to this one
I'm practically lost here. I've been trying to fix this for three days and I've looked into dozens of Stack-Overflow posts with similar problems, haven't found a solution.
Any idea will be appreciated.
Thanks.
I repeated your error:
I made it by deleting Android SDK(not java SDK) in Android Studio:
File-Settings-AndroidSDK
Try to pick at least one and install
It seems that your problem is related to Android SDK
Okay guys, I've finally figured it out, thanks to artmmslv.
Android Studio's installer detected automatically - two versions of Android SDK which were corrupted (probably caused by BSOD messing up the installation).
I had to make sure to delete everything. Java SDK, Android SDK. Java JRE. Every data from Appdata or documents from Android Studio. Once the computer is clean from any traces of already installed plugins, modules, and whatnot, it should be able to set up perfectly fine paths.
Also, make sure to set up manually and correctly the Environmental Values of java (path edit and JAVA_HOME).
Thanks for the help.
I got a solution that was a problem for me.
(in Build.Gradle file) - It's the
Compile SDK version 32
//which was not the latest one,
I changed it from older (31) in old projects to (32)
And clicked: sync now,
it worked!!
Hope it helps:) Happy coding

JavaFX on Android - Gradle can't find JDK

I'm trying to get JavaFX applications to run on Android by using the Dalvik JavaFX-Android SDK (provided by the JavaFX Android porting team). So I downloaded the samples provided by the JavaFX Android porting team and have been trying to run one of them on Android without much success.
Using Eclipse with the Gradle plugin I imported the "HelloWorldFxml" sample project. Then I ran the Gradle task "./gradlew androidInstall" on the project like the README file told me. But unfortunately the task cannot execute because Gradle cannot locate my JDK:
(source: forumbilder.se)
Even though my JAVA_HOME system variable is correctly set and I havn't had a problem with it before:
(source: forumbilder.se)
Anyone that can provide some insight as to how I can fix this?
Versions: Eclipse Luna Service Release 1a (4.4.1), Gradle 2.2, dalvik-sdk-8u40-ea3, Android SDK Build-tools 21.1.2, Android SDK Tools 24.0.2
Edit: The console output when running "gradlew androidinstall" on a sample project:
Even though the error message doesn't specify it, maybe it's looking for javac in your PATH? In case it's not in there try adding ;%JAVA_HOME%\bin to the end of your PATH variable (and restart Eclipse afterwards, I've had the problem of running processes not getting changes to environment variables before).
Check the Java setting in Eclipse:
Window -> Preferences
Java -> Installed JREs
Make sure that your JDK 1.8 is listed there. If it's not, add it using the Add... button.
Once the JDK is known to Eclipse, make sure that your project's settings use that JDK as a compiler, and the Gradle plugin should be able to pick up the setting from there.
In a pinch, you should also be able to run Gradle from the command line, and it should work fine since you already set the %JAVA_HOME% variable.
Basic Note
Since the release of dalvik-sdk-8u40-ea3, and in very short time, the JavaFXPorts team has released a few new versions, all of them simplifying all the process of porting a JavaFX application to Android or iOS.
They released dalvik-sdk-8u40-ea4 and they announced the release of a new plugin, that will simplify to the minimum the steps to create a mobile application from JavaFX.
While this answer may not help the OP in his particular problem, definitely it will help him and others, since everything is really simplified.
New approach
With this plugin, there's a new way of creating the HelloWorldFxml application for Android.
The new javafxmobile-plugin allows you to generate the apk with a single 'build.gradle' file.
You can find this an other basic samples here, and download the repository here.
You won't need to edit a single line, just type this on the command line, on the root of the sample, with your device connected:
gradlew androidInstall
As for previous releases, you will need JDK8u40 and Android SDK installed. No need for dalvik-sdk though, it's retrieved by the plugin.
Notice that you can open these samples from your IDE, so you will be able to modify them, and run them locally or build again the apk for your device.
Had this problem, too.
My proberties:
-Windows 7
-Dalvik SDK (dalvik-sdk-8u60-b5)
-JDK 8 (newest Version 8_60 / IMPORTANT: JDK not JRE)
-And I tried also the HelloAndroid project provided by the Dalvik-SDK-download.
So i execute the command line: gradlew installDebug
My probelm was nearly the same.
"Fail to find JDK. Please make sure there is a JAVA_HOME or JAVA8_HOME systemvariable."
#1
Created these proberties. Just like described in this post:
How to set java_home on Windows 7?
So to make everything sure, I created both with the same path. Cause I don't know exactly which one is used by gradle.
#2
This is really the hack that helps me out. Found this also in StackOverflow.
Write in your build.gradle under the android{..} stuff this line:
retrolambda {
jdk 'C:/Program Files/Java/jdk1.8.0_60' //<--your JDK-path
}
it looks like that
Then execute the same command line again and it worked for me.
I think only the 2. steps was the solution, cause I guess gradle don't look for the variable if there is a direct path to the jdk.

Chilli Source Android build on windows

I've tried building the CSEmptyTemplate project in eclipse for android but have run into a host of issues with it.
Looking at the documentation, it doesn't appear as if it should be this difficult.
Firstly, I've installed cygwin and installed the devel package to get make.exe and gcc compilers. I'm also using cygwin as part of the tool chain.
However, the error I keep getting is 'make: *** No rule to make target `all'. Stop.'.
Any advice on fixing these issues would be appreciated.
edit: Found the make files. I was just an idiot last night when working on this.
There shouldn't be any additional steps required to build Chilli Source for android on windows, just the simple steps listed on the website here: http://chilli-source.chilli-works.com/docs/?page_id=67
However setting up the Android Development Tools with the NDK can be a bit of a pain. Judging by the error your getting my gut feeling is that something isn't set up correctly there.
Chilli Source requires the latest versions of the SDK, NDK and ADT. Can you ensure you have:
Android API level 21.
The latest versions of the Built Tools, Platform Build Tools and Google Play Services.
NDK revision 10c.
The latest ADT is also missing a couple of things that means it can't be used out of the box.
It doesn't come with the native dev tools which can be acquired by doing the following:
Go to "Help" then "Install New Software..."
Select "Android Developer Tools Update Site - https://dl.google.com/android/eclipse". You make have to edit it to instead point to https://dl-ssl.google.com/android/eclipse
In Developer Tools select and install Android Native Development Tools.
It also doesn't come with ant. This isn't causing your issue, but it will cause issues later on, so get it following these steps:
Go to "Help" then "Install New Software..."
Select "Juno - http://download.eclipse.org/releases/juno"
In General Purpose Tools select and install Eclipse Plug-in Development Environment.
Now that you've got everything required, ensure that you've got it set up correctly:
The correct version of the SDK selected the Android tab in preferences.
The correct version of the NDK selected in the Android/NDK tab in preferences.
Android 5.0 selected in the Android tab in Project Properties.
Finally, on windows you also need Cygwin. It's been a while since I've used it (I'm not a fan of cygwin so I do my Android development in a Ubuntu virtual machine) but only the "devel" package is needed iirc, so make sure you've at least got that.
Hopefully ensuring all of that is set up correctly will fix your problem!

How to resolve this android buildtoolserror

I get this error
[2014-07-11 17:50:02 - App1] Using 1.7 requires using Android Build Tools version 19 or later; currently using 17.0.0
when i tried to use switch with strings (have to use jre version 1.7 to do this). I read on http://shuklaxyz.blogspot.com/2014/06/eclipse-error-using-17-requires-using.html that to fix this error, you have to put this line
sdk.buildtools=19.1
in your project.peoperties folder. I tried doing that but that didnt even work. I saw on the manifest that there nothing for build tools. Does anyone know a command i can use to resolve this problem?
You need to update your Android Build Tools to a later version. Unfortunately like a lot of things in the Android SDK it's not obvious how exactly you do this.
Open the Android SDK Manager
Under Tools, tick "Android SDK Build Tools 20" (or whatever the newest version is
Click Install Packages
Restart Eclipse

Categories

Resources