Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
java.io.FileNotFoundException: C:\Users\User_Name.gradle\caches\2.14.1\classAnalysis\cache.properties (System cannot find the file)
Android-Studio show this error message and I don't know what it is or what should I do.
It show this when I try to run an app and I answer "Proceed without Instant Run" to this question:
"Instant Run requires that the platform corresponding to your target device (Android 1.0) is installed."
At first Upgrade SDK Manager .
This exception is thrown during a failed attempt to open the file denoted by a specified pathname.
You can use
compile 'com.google.android.gms:play-services:current_version'
& Use this
classpath 'com.android.tools.build:gradle:current_version'
Then Clean-Rebuild Your Project .
Delete folder config in C:/user/user/.android
As my opinion , this type of error found When your app run in Instant Run feature of Android Studio. so, new build not generated every time and app content not found in your android device.
Click here to get solution
http://tools.android.com/tech-docs/instant-run
Related
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"
After installing ionic and android sdk one windows, I tried to build a sample app running the command ionic build android.
It so happens that after running this command, and after some seconds the following message appears:
Usage: java [-options] class [args...]
(to execute a class) or java [-options] -jar jarfile [args...]
(to execute a jar file) where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image See http://www.oracle.com/technetwork/java/javase/documentation/index.html
for more details.
Error: cmd: Command failed with exit code 1
For this error I tried to reinstall java JDK7 and also installed JAVA8, and also I switched node version (tried node 8 and 6) , but nothing has worked. Because this error is so generic, I am having difficulties knowing what should I look for.
I'm also running windows 7.
Can anyone help me with this?
I am trying to run a react-native app on android emulator, but I am getting an error like
Error calling Appregistry.runApplication
AVD: 'Nexus_5X_API_23(AVD) - 6.0
OS:Windows 10
Please help on this?
I had almost the same problem you currently have a few days ago. For me it was a real device.
From all my research, the solution that worked for me is the following :
When you launch your app by typing react-native run-android, the error appears.
So, reach your directory containing "adb.exe" ( for me it was C:\Users\username\AppData\Local\Android\Sdk\platform-tools\ )
open a terminal from here. And type adb reverse tcp:8081 tcp:8081
Then, by reloading the app on the phone, it should work.
I hope this will help you !! ( if not, shame on me )
Cheers ;)
EDIT :
I've find a more convenient solution to solve this problem.
When you launch your "react-native run-android" you might have a comment saying "adb is not recognized as internal or external command..."
Well, instead of manually using the adb command, you can add an environment variable leading to the adb.exe.
Just get to the "Control Panel" > "System and Security" > "System" > "Advanced System Settings".
From here, click on "Environment Variables". Search for the "Path" variable in the "System Variables" section. Click on it and press the "Edit" button.
There you can add a new path to this variable. Just click the "New" button and write the adb.exe path. For exemple C:\Users\username\AppData\Local\Android\Sdk\platform-tools\
(For the oldest versions of Windows, you'll have to add ";C:\Users\username\AppData\Local\Android\Sdk\platform-tools\" to the content.)
This is it, now the adb reverse tcp:8081 tcp:8081 command will be ran automatically upon building.
Hope this will even more helps you !
I had the same issue, my fix was to run
$ react-native start
in the background then run
$ react-native run-android
According to me this error comes when:
1) You did not run the packager at the right place i.e, you hit the wrong folder to run react-native packager so just navigate to your project's directory and run react-native start.
2) when you code something wrong with respect to Appregistry module.
3) Shutdown everything Xcode, packager, simulator etc and restart it again.
4) From the error one thing strikes in my mind is the name of the module
AppRegistry.registerComponent('AppName', () => componentName)
matches with the #"AppName" on your AppDelegate.m on the call for
[[RCTRootView alloc] initWithBundleUrl:...
moduleName:#"AppName"
launchOptions:...
5) As we are using react's component so we need to give the first character of our class name with caps on.
6) Let's see what's wrong in index.android.js and index.ios.js
Cheers :)
Finally, I got it working.I created a new AVD
Nexus6 API 23
.Earlier I was trying with Nexus5x API 23.Thanks all
I had same problem. It occurs that McAffee was on port 8081 and block packager.
My solution:
react-native start --port your_port
In android emulator, Command + M show dev menu, click on "Dev Settings" and then click on "Debug server host and port" and set it to your_ip:your_port.
Then
react-native run-android
In my case (after, of course, going through everything I could find here and elsewhere), I realized I had turned my WiFi off on my phone...doesn't work like that! Hope it helps someone
I had the same issue and was able to resolve it by setting my local computer as the debug server in the android emulator. Open the android emulator, Command + M to bring up a menu, then click on "Dev Settings" and then click on "Debug server host and port" and set it to 127.0.0.1:8081. Then from within you project directory run react-native run-android. I hope this helps.
Make sure that port 8081 is available. In my case One of my services is running on Port 8081(tomcat webserver).
I was having the exact same issue (because this is a very generic message) but the problem was different. In my case it was a newly created project, the emulator wasn't working but a real device did work.
My problem was the limit of watchers inotify can handle on Linux by default, which is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem, and report those changes back to applications and it's widely used, including android studio and react native; by the time I was trying to execute react-native run-android all of the watchers were allocated on my system, causing the process to fail on this same message.
To change the max amount of watchers inotify can handle, you need to edit the file sysctl.conf, which will be usually located at /etc/sysctl.conf or /etc/sysctl.d/custom_name.conf and add the following line:
fs.inotify.max_user_watches = 5242881
After writing the file you need to execute sysctl -p filename.conf where 'filename.conf' is the path and name wherever you saved the .conf file for sysctl. Once changes are applied everything should work as expected.
I too had the same problem. I solved the problem to run on real device.
As told by Mr Jedi, McAffee blocked the port 8081. So I have modified Project-Folder>\node_modules\react-native\local-cli\runAndroid\runAndroid.js file's function from
function tryRunAdbReverse(device) {
try {
const adbPath = getAdbPath();
const adbArgs = ['reverse', 'tcp:8081', 'tcp:8081'];
to
function tryRunAdbReverse(device) {
try {
const adbPath = getAdbPath();
const adbArgs = ['reverse', 'tcp:8081', 'tcp:3040'];
and started the application on
react-native start --port 3040
For me I just needed to add the platform tools to my Path environment variable so that react-native can start the adb server.
I was getting:
'adb' is not recognized as an internal tool or program
To fix this I added the following to my Path environment variable.
C:\Users\<Username>\AppData\Local\Adnroid\sdk\platform-tools
Then running react-native run-android worked!
I know this question has been given so many answers but, I think it's worth it adding my solution, hope this helps someone out there.
In my case the problem was from my virtual machine, although I didn't investigate but by creating a new virtual device the app ran smoothly with no problem.
So just create a new virtual device. :)
I searched for a solution for my registry error for a week and tried all these solutions, and all that was missing was I needed to add in my app.json file under expo:
"platforms": [
"ios",
"android",
"web"
],
So, if all else fails, try to add this into your expo.
I have gone through the instruction found on Parse.com to setup Cloud code. I downloaded exe file as instructed in 1. It seems like there is a step missing before step 2.
When i run "parse new" in the command prompt i get "not recognized as an internal or external command". What am i missing? How do i install/use cloud code?
Get the Parse tool
The Parse command line tool for Windows is available here. Download
the Windows executable named: parse.exe at this link. Note that this
is not an installer, it is just a plain Windows executable.
Set up a Cloud Code directory.
From the Command Prompt, run the command parse new and follow
instructions. In this quickstart we'll see how to set up your server
code on Heroku. Please read docs for more details.
I just downloaded the parse CLI on my Windows desktop to figure it out and I believe I've found your solution.
You need to open up a standard command line on windows and then navigate to where you have stored parse.exe. Once the command line is at the same directory as the exe, you will be able to run parse new and any of the other CLI commands.
For example, you could do the following:
Hit the Windows key (or start menu) and search "cmd" then hit enter to open the command line
Navigate to where parse.exe is located. If it's on your desktop, it could be something along the lines of cd C:\Users\<name>\Desktop
parse help, parse new and so on should now work from this directory
The documentation feels a bit vague and could use some clarification for the Windows platform. Hope this helps!
An Error is showing when I running the Android Project using Phonegap 3.0 in Command Line Interface
(Phonegap local run android)
Cordova CLI: an error occurred during creation of ios sub-project,The system can not find the path specified.
I have also tried the following steps
$ cordova create HelloWorld com.example.hello "Hello World"
Then try removing the whitespace between Hello World.
$ cordova create HelloWorld com.example.hello "HelloWorld"
Then It was giving the same error.
D:\Applications\TestApp1>Phonegap local run android
[phonegap] adding the Android platform...[error] An error occured during creation of android sub-project. The system cannot find the path specified.
Please suggest
[solved]
if you are using windows.
don't forget to install jdk. you can found it at link.
try to follow this instruction on youtube .
and for the detail instruction you can follow the phonegap get started page.
next, install the sdk android first. goto developer*android*com/sdk/index.html to download the package. furthermore extract them, and open the "sdk manager" at your path. install more package of API's as you needs.
i recommend to install gingerbread(2.3) api 10 and ICS(4.0) version.
on this progress install ant package you may found a trouble same as me. but don't worry, I've found the answer.
just follow this instruction on youtube*com/watch?v=bAbBqrTG3q4 . by using my package on drive*google*com/file/d/0B4B3LaTbByxAWlVpQjJhSjd5dVU/edit?usp=sharing .
if you still have an error, you can call me on YM : rifqi_platinum25.
note: change [*] with [.] to access the page. i'm sorry for inconvenience because i haven't at least 10 reputation to post with over 2 links. thank's.
I think you're having a problem of creating a new project. You can try it by changing the location as cordova create ../HelloWorld com.example.hello "HelloWorld"