Is sdk going to be failure [duplicate] - javascript

After a successful import of an Eclipse-Android-Project into "Android Studio 1.4", I get the error
"Please select Android SDK"
when I click on the button to run the application in the simulator, I can't find any way of doing that.
This dialog opens when I click on "run":
This is the "project structure" dialog:
What should I do now?

I go to build.gradle and click sync now. Then it worked.
Update :
File -> Sync Project with Gradle Files (Android Studio 3.1.1)
Tools -> Android -> Sync Project with Gradle Files (Android Studio 3.0.1)
Or You can click on the icon from the toolbar.
This answer may not help works for later version as Android studio Team work on making the tool more better, the way to sync may be different in the next version of Android Studio.
COMMON WAY that may helps is try to sync project and then Invalidate Caches and Restart Android Studio.
Solution for Android Studio 3.1.2 [See below answer]
See Latest Android Studio version

FIX FOR 3.1.2 OR NEWER VERSIONS
Some of my colleagues and I have faced the same issue on AS 3.1.2, but a simple Sync didn't help us. For us, the solution was a bit different:
File -> Invalidate Caches -> Invalidate
File -> Close Project.
Remove the project from the AS project selector window.
Quit from Android Studio
Start AS and open project again
EXTRA ADVICE IF YOU ARE FACING THIS ISSUE CONSTANTLY
Some of you are constantly facing this issue, and this "solution" fixes it only temporarily. At the time we started getting this error, we used gradle wrapper 4.6 and Android gradle plugin 3.1.0, but since then we went back to gradle 4.4 and we use it with the latest Android gradle plugin, and we haven't seen this issue since then.

In Android Studio 3 and above, for Windows, Mac and Linux:
File -> Sync Project with Gradle Files
Solved!
Or you can do this by shortcut key:
Press ⌘ + Shift + A (Mac) or Ctrl + Shift + A (Windows, Linux). Then pop-up a Edit-Text and write "Sync Project with Gradle Files". Then press double click on the option.
Your problem is solved! It'll sync your gradle file with your project file.
Screenshot:

Click this icon to sync gradle
or edit any of your module gradle and then sync

Press "Ctrl+shift+A" and in the pop-up EditText, write "Sync Project with Gradle Files". After that double click on the appeared option. It will then sync your Gradle file SDK with the project file.

Just go to the (app level) build.gradle file, give an empty space somewhere and click on sync, once gradle shows sync complete then the Error will be gone

This is the easiest way to fix this issue:
Add a comment line to the gradle file
It will then ask you to Sync.
Click 'Sync Now'
Viola! You're done.

Now on Android Studio 3 and above, you can try to sync project with gradle like:
File -> Sync Project with Gradle Files

The menu structure and options have changed slightly as of Android 3.2.0. I fixed this error by changing the Module SDK in the following menu:
File > Project Structure > Modules > App File > Dependencies Tab > Module SDK
Make sure to hit Apply to save your changes.

The comment from #Nisarg helped: "set latest version in Compile Sdk Version"
I changed from API 8 to API 23 and the error message disappeared.

Press the first refresh button on the gradle vertical tab in Android Studio on the right

Press " ⌘ + Shift + A" on Mac (or "Ctrl+Shift+A" on Windows) and in the pop-up EditText, write "Sync Project with Gradle Files". After that double click on the appeared option. It will then sync your Gradle file SDK with the project file.

Follow these steps:
Goto Android Studio Settings
Search for "Android SDK" using search bar
Ensure the path to your android sdk folder is correct.
After that also ensure the path is automatically updated after a prompt in your project (local.properties) file. If not, do it manually.
Hope this helps.

There are multiple hit & trial solutions for this error. One of them will surely work for you.
Below are the solutions:
1.
Tools -> Android -> Sync Project with Gradle Files (Android Studio
3.0.1)
Go to build.gradle and click sync now
Click hammer(Build) icon to sync Gradle
or edit any of your module Gradle and then sync
File -> Settings -> Android SDK -> Android SDK Location Edit ->
Android SDK
Open build.gradle file, just add a space or press enter. Then sync
project.
File -> Invalidate Caches / Restart

Go to File >> ProjectStructure(⌘;). This would open this window then select the app module. Then choose the Compile SDK version . Choose the latest one and click apply.

I was having this problem on all versions of AS 3.0+. Syncing with gradle did not solve the problem for me. The solution from András Klöczl was the only thing that would allow me to get some coding done. The problem was, anytime I had to do a gradle sync, the problem came back. So I had to go through that process any time I wanted to make a change in my build.gradle. What ended up working for me was to downgrade my kotlin version from 1.2.40 to 1.2.30

My problem was that if I changed the project (for example opened new window of Android Studio with different project) this error happened.
So I read every answer in this question and the "clear caches and open the project again" solution wasn't so useful in my case.
Instead I discovered that if the Kotlin's plugin's version in Android Studio was lower than in gradle file, the problem appeared.
My setup was:
Android Studio 3.1.3
Kotlin plugin (in Android Studio) 1.2.30
Kotlin version in gradle file 1.2.51
What fixed the problem?
I updated the Kotlin plugin:
File -> Settings -> Plugins -> Install JetBrains plugin...
Then search for Kotlin and click Update. After update just restart the Android Studio and sync Gradle.

Just change build tools version to 25.0.3.. and sync now
I hope it will help..

This worked for me.
File -> Settings -> Android SDK -> Android SDK Location Edit -> Android SDK

Go to : File > Project Structure > Modules -> app > Properties
please choose : Compile 'SDK' version = API26 Build Tools
Version = 27.0.0 Source Compatibility = 1.8 Target Compatibility =
1.8

open build.gradle file. just add a space or press enter. then sync project. it works...

Sometimes android studio just acts stupid and needs some kind of reset..
Go to settings.gradle file it should contain include ':app'
change it to include ':ap' and sync.
after sync, change it to include ':app' again.
It should be working OK now.

The simplest solution for this problem:
First make sure your sdk path is currect.
Then
Please close current project and in android startup menu click on import project and choose your project from explorer.
This will always solve my problem

In my case there there is no selected java sdk version in project structure-
I had to select the -
1.Source Compatibility (1.7)
2.Target Compatibility (1.7)
as shown in image.

If you are using 'Profile or Debug APK...', then you might come across this error.
My solution is to first check SDK for updates in SDK manager: click on "Edit" at the right side of SDK location and go through to install any updates:
Then I clicked on "Logcat" at bottom of Android Studio and find out I also need to configure Android SDK, so choose latest Android API Platform:
After that, I'm able to run the APK in Emulator.

In latest android studio 3.3.2 the icon of sync project with Gradle Files is changed
Now try this
File -> Sync Project with Gradle Files (Android Studio 3.3.2)

For Android Studio 3.5, "File -> Sync project with gradle files" is enough.

Go to gradle.build file and click sync now
OR
click icon on Sync project with Gradle file
OR
Go to Tools-> Android -> Sync project with Gradle file

If your android SDK path is given and still you facing this issue then it might because your android studio not synced well, even you have clicked on "Sync now" link.
So for re sync it go to app gradle file and make any change or just give a space and now sync again. It will work perfectly.

In my case I downloaded a git repository for an android project. The project required minimum sdk version 21 and target sdk version 27. When I tried to run the project it gave me "Please select Android SDK error". I checked that I had already downloaded the required sdk files.
For me the solution was to "sync project with Gradle Files"

Related

Is there a way to Invalidate / Cache restart from terminal?

I was wondering if there was any command from terminal that I could use to match the use in Android Studio of doing file>invalidate cache/restart.
Thanks!
According to a JetBrains employee doing the following will have the same effect:
Shut down Android Studio externally (using kill or similar command), then
Delete system/caches directory (more on that later), and
Start the IDE again.
How to find system/caches directory?
Location of the IDE files depends on the operating system, product and version.
For IntelliJ IDEA follow this guide.
So e.g. for IntelliJ IDEA 2020.3 on macOS you should be looking for ~/Library/Caches/JetBrains/IntelliJIdea2020.3/caches directory
For Android Studio follow the same guide as above but instead of JetBrains in the path use Google
So e.g. for Android Studio 4.2 on macOS you should be looking for ~/Library/Caches/Google/AndroidStudio4.2/caches directory

Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. , Failed to install the app

enter image description here
Im new to React-Native and this is driving me insane, I just want to launch the project in the and view the project in the emulator so I can just start coding, I have tried downloading the latest version of JDK, which is apparently not even needed since android studio comes bundled with its own version & also how do I know what version of JDK my android studio comes bundled with ?
I have been trying to fix this for days now, I even got Blue screen of death when after I messed around with the enviroment variables so now I am desperate and want someone to point me in the right direction.
React native install app on a single running device. Make sure your emulator is in running condition
check all connected devices which are eligible for installing using a command
adb devices
one device at a time
Please check your JDK path for android and ios, if all things are correct the see the project files in the project.
Then run your project.
I hope it runs.

I can not find "generate signed apk" in android studio after I load my source code

I got source code from my android developer, then I loaded it using android studio. There is no process sync, the code just loaded successfully.
After that, I tried to produce new APK. Unfortunately the tool does not appear in my android studio, but when I load different source code, the tool appears (generate a signed apk).
I already cleaned and rebuilt the project, but the result is the same. It's not showing generated signed apk.
I searched in build.gradle, inside app folder, and I also found this in configs:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
rebuild the project
Doesn't generate a new singed APK. Go to > Build > Generate Singed Bundle/APK....
Be sure that you open project with your android studio well.
If it, not an android studio project. You should go to. File -> New -> Import Project...

Adding Cordova Platforms

Hey, Guys! I recently started to work with Cordova and when I run the Cordova platform add android i get the following error. I have successfully placed the environment variables for Java and for the Android SDK as well. But the npm modules does not exist in C:/Windows/System32/npm as shown in the error, It is in the Users/My username/AppData/Roaming/npm folder. Some guidance would be appreciated.
I followed the following scripts which are shown in the official Cordova documentation to create a new project.
Cordova create hello com.example.hello HelloWorld
cd hello
Cordova platform add android -> where I'm stuck at
Kindly Check the Android Version Provided by Cordova and verify with your current Android version installed on your system , if there a mismatch :
1) Update Android Version From Android Studio SDK Manager
2) Update Cordova Platform - Refer: Cordova Documentation
External Source
cordova - Error: Failed to fetch platform android
I figured out halfway what the the problem was. There was a file named 'npm' in my C:/Windows/System32 directory wich was of 0kb size, and once i deleted it, the error vanished. But not all the way though. I was able to install the browser platform but not the android platform via cordova platform add android or even specifying what the matching cordova-andriod pluggin to be with cordova platform add andriod#version.
Only through the cordova platform add https://github.com/apache/cordova-android.git script I could install the andriod platform and once it was done other steps worked fine, and the project ran through the Android AVD. Any idea why the normal command to add the android platform didnt work, Just want to know but if it happens again i think Im gonna have to run the get from git command again. Thanks

Google Play reject Cordova application 'cause contains security vulnerabilities for users

I developed an application on Apache Cordova, I followed all the steps to generate the .apk to upload on Google Play. I tried many times but Google's response is the same:
We rejected APP, package ID com.xxx.app, for violating our dangerous products policy. If you submitted an update, the previous version of
your app is still available on Google Play. This app uses software
that contains security vulnerabilities for users. Below is the list of
vulnerabilities and the corresponding APK versions that were detected
in your recent submission. Please upgrade your app(s) as soon as
possible and increment the version number of the upgraded APK.
Vulnerability Apache Cordova: The vulnerabilities were fixed in Apache Cordova v.3.5.1.
I have the latest version of Cordova (5.4.1).
The following will detail the steps that I followed for installation and project development:
Start the download of Cordova from the console Node.js using the command npm install -g Cordova.
Install Java: version 1.8.0_65.
Install Android SDK.
Add Java and SDK to PATH.
I downloaded the necessary components of the Android SDK.
Create the project through the commands. (Cordova create Projectxxxx).
Add the Android platform.
I copied my application code in the www folder.
Add the plugins needed for my project: splashscreen and sqlite.
I tested the application on the Android emulator and other mobile phones. All good. Runs perfect.
To create the signed APK file, these are the steps:
-Cordova build --release android. (This generated the android-release-unsigned.apk on platforms / android / build / outputs
/ apk).
-Then, I generated the keystore.
-After the jarsigner.
-Finally: zipalign.
I upload end-app.apk to Google Play.
Another detail that I have is that cordova.js generated version is 4.1.1. But the console version is 5.4.1 (Command: Cordova -version).
I did everything by node.js console.
Attemps:
I uploaded an APK without js components. Only with cordova.js and it not worked.
I installed all over again in a newly installed windows and neither worked.
My version is higher than 3.5.1. I can not find the solution.
The big problem is not just that PLATFORM_VERSION_BUILD_LABEL is wrong, but the default cordova used is ancient ( it was 3.7.1 on mine ). To resolve this you need to install a newer version in the project. You can specify this on the command line, much like npm does.
cordova platform update android#4.1.1
Or you can specify it in your config.xml
<engine name="android" version="4.1.1" />
That may need 'spec' instead of 'version' depending on how current you cordova install is. At this point, they are up to 5.1, and you can use 'latest' instead of a specific version number.
The next headache will be the point of the patch, which locks down network access. I am now getting 404 errors on all my ajax calls to our server. Access was the root of the security problem, so this isn't a big surprise. I am still working on that.
I had the same problem, I found a previous corodva version in a plugin, in my case was facebook connect; I deleted this plugin and upload again, its work form me. You may search PLATFORM_VERSION_BUILD_LABEL in your project, is posible that some plugin have other cordova version.
I was trying to solve this problem almost for a week. Solution:
There was a cordova.js file within www/lib/cordova folder that doesn't get updated when you update cordova and ionic. Open the file and look for var PLATFORM_VERSION_BUILD_LABEL. If the version is not 4.1.1 at the time of this post, update it with another copy of the file that is somewhere in your main directory.

Categories

Resources