Android Gradle export failed - android

I am having trouble migrating my eclipse project to Android Studio. I followed the instcutions on this page http://developer.android.com/sdk/installing/migrate.html
When I type gradle at the command line I get this error:
Where:
Settings file 'C:\Users\Joshua\Development\workspace\settings.gradle' line: 1
What went wrong:
A problem occurred evaluating settings 'workspace'.
A path must be specified!
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 1.1 secs
What path do you think it wants? And where does it want it?

So in my case I had a multi-project environment, what I had to do to get it working was to remove the absolute paths from the settings.gradle file in the root directory (dir containing all of the projects) and then in the build.gradle i had to remove the absolute directories for the compile statments and make sure that i used :{project_name} instead of ../{poject_name}
I realise that my situation was a bit different but if you download gradle and use the --debug switch you should be able to find which files have the problems and it's most likely a path problem.

You might be missing your lop-level build.gradle file. Here is a setup explained
If this is not your issue, please provide your settings.gradle file and top-level build.gradle file.

Related

How to Add Stacktrace or debug Option when Building VSCode Project

When I run the emulator while using vscode, I get an error like this. What can I do?
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org```
This error occurs because of the path of the project. Change your project path with a way which don't contain non-ASCII character.
For example ะก:\Android\PROJECT-FOLDER.
First run flutter doctor, to see if everything is okay
Then run flutter clean, to have a fresh start
If that doesn't work check the name of the path and try not to use special characters by that I mean, use English.
Or do a workaround and create a new project and copying the files to the new project, as I said before, stick to English, as a Spanish speaker I've run into the same issues before.

google-services.json file is missing

I placed google-services.json file in my /app module directory. Still getting this error!
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Is there an updated solution to this problem? Please, anyone help me.
Same thing happens with me.
Remove the google-services.json file from your project .Set up for the API which you want in your project(Maps,FCM,etc).then place your google-services.json file in your root directory.Rebuild and clean.
Hope this will help you.

Task 'generateDebugSources' not found in project ':app'

I been developing my app in my Macbook and I put my project in Github.
I got a windows laptop and cloned my project from Github but when I build my app I'm getting these errors and my app won't build:
Error:FAILURE: Build failed with an exception.
* What went wrong:
Task 'generateDebugSources' not found in project ':app'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
How do I fix this?
Thanks
Please Check for file "YourProject/app/build.gradle" may be it is not there or it get corrupted( some times due to power failure the current running file become blank ). if you have older backup copy all syntax from there and past it on "YourProject/app/build.gradle".
I solved this problem in Android Studio by running File > Invalidate Caches...

Gradle build not executing because it can't find cache.properties

My gradle build in android Studio is failing because it can't access the cache.properties file. I have tried invalidating all caches and retrying but that did not work. I also reinstalled all the SDK tools. Here is the error I'm getting
Error:java.io.FileNotFoundException: C:\Users\Siddharth\AndroidStudioProjects\IntentAssignment.gradle\2.4\taskArtifacts\cache.properties (The system cannot find the file specified)
C:\Users\Siddharth\AndroidStudioProjects\IntentAssignment.gradle\2.4\taskArtifacts\cache.properties (The system cannot find the file specified)
Blockquote
Any advice on what to do, here is the complete console output:
FAILURE: Build failed with an exception.
* What went wrong:
java.io.FileNotFoundException: C:\Users\Siddharth\AndroidStudioProjects\IntentAssignment.gradle\2.4\taskArtifacts\cache.properties (The system cannot find the file specified)
C:\Users\Siddharth\AndroidStudioProjects\IntentAssignment.gradle\2.4\taskArtifacts\cache.properties (The system cannot find the file specified)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.747 secs
delete gradle folder, quit Android Studio and Start again fixed this problem for me
run cmd
write %temp%
then temp folder open delete all file in temp then rebuild your project
hope this will solve your problem
After Search i found this answer and worked for me
thanks to #Salam El-Banna and #Naveed Ahmad
You don't have to delete all .gradle folders and no need to reinstall Android Studio.
I have the latest version of Android Studio and I faced that problem, the only thing that worked for me is to:
1- Navigate to
C:\Users\user.gradle\caches\2.x\
2- Copy the folder scripts , scripts-remapped and paste it somewhere safe just in case anything went wrong you will place it back
3- Delete this folder scripts and scripts-remapped from the directory C:\Users\user.gradle\caches\2.x\
4- Sync Project with Gradle Files and you are done.
When you sync your project Android Studio will generate new cache files.
It worked for me I hope it will work for you.
reference:
Cache.properties (The system cannot find the file specified)
Delete your Gradle folder
Invalidate cache and Restart
Simply these steps fix your issue.

Cannot build CastVideos-android, Error: Bad pathname

I have cloned from github both the respositories CastVideos-android and CastCompanionLibrary-android to my AndroidStudioProjects folder with the names 'CastVideos' and 'CastCompanionLibrary'. When I attempt to build CastVideos, in Android Studio I get
Gradle 'CastVideos' project refresh failed
Error:Bad pathname
When I run 'gradlew.bat build' in the CastVideos directory, I get the below:
C:\Users\Tim\AndroidStudioProjects\CastVideos>gradlew.bat build
Relying on packaging to define the extension of the main artifact has been depre
cated and is scheduled to be removed in Gradle 2.0
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'CastVideos'.
> Could not normalize path for file 'C:\Users\Tim\AndroidStudioProjects\CastVide
os\build\intermediates\exploded-aar\CastVideos...\CastCompanionLibrary\unspecifi
ed\debug'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 7.701 secs
C:\Users\Tim\AndroidStudioProjects\CastVideos>
This is my first attempt at using Android Studio after developing with Eclipse so I am a bit lost. Any suggestions?
I think I know why. It is a Windows thing. It seems that Windows does not realize that '..' mean upper directory. that is why you have this path "C:\Users\Tim\AndroidStudioProjects\CastVide os\build\intermediates\exploded-aar\CastVideos...\CastCompanionLibrary\unspecifi ed\debug" I am running on the mac which seems to be working fine
I would suggest that you copy the whole CastCompanionLibrary into your CastVideo directory and then change ..:CastCompanionLibraries to :CastCompanionLibraries
Changing relative paths from ..: to ./..: in both build.gradle and settings.gradle worked for me on Windows.

Categories

Resources