I am trying to build my project using fdroid but it keeps failing when it gets to gradle. The project builds well in android studio but it always fail in gradle command line. I have search google multiple times but i could not get help from any website. I have set my ANDROID_HOME to /home/collins/Android/Sdk but it seems gradle ignores the variable, Each time i try to build, i noticed that gradle generates a local.properties file with the wrong sdk location value:
sdk.dir=$ANDROID_HOME
sdk-location=$ANDROID_HOME
I don't know if there is a way to set the global default value for any project in gradle. Here is the full log from fdroid build
INFO: Building version 3.0 (3) of com.simpledecredwidget
INFO: Getting source for revision 0ca18981c4b3825861b07e1f2444f711fc8a4fa5
INFO: Creating local.properties file at build/com.simpledecredwidget/local.properties
INFO: Creating local.properties file at build/com.simpledecredwidget/app/local.properties
INFO: Cleaning Gradle project...
ERROR: Could not build app com.simpledecredwidget: Error cleaning com.simpledecredwidget:3.0
==== detail begin ====
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/app/$ANDROID_NDK.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
==== detail end ====
INFO: Build for app com.simpledecredwidget failed:
Error cleaning com.simpledecredwidget:3.0
==== detail begin ====
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/app/$ANDROID_NDK.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> The SDK directory '/home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
==== detail end ====
INFO: Finished.
INFO: 1 builds failed
EDIT
As you can see in the error above, The sdk location /home/collins/Documents/Projects/fdroiddata/build/com.simpledecredwidget/$ANDROID_HOME was used which was incorrect, i don't know where this bug is coming because a different value was set in local.properties file which value is sdk.dir=$ANDROID_HOME
Related
cmd > flutter run
Launching lib\main.dart on Lenovo A6020a40 in debug mode...
Initializing gradle... 1.8s
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\Mantu Kumbhakar\Downloads\sytody-master\android\gradlew.bat" exited abnormally:
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\Mantu
Kumbhakar\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
BUILD FAILED
Total time: 3.065 secs
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 27
What went wrong:
A problem occurred evaluating script.
Could not find method google() for arguments [] on repository container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Command: C:\Users\Mantu Kumbhakar\Downloads\sytody-master\android\gradlew.bat app:properties
This error is sometimes generated when you try to run a project created using an older version of Flutter than the one you're currently using.
The issue can also be found on the Flutter GitHub repository.
Until an official solution to this issue is provided, you can fix it by recreating the project with your newer version of Flutter, as suggested in the above GitHub issue too.
Above, when Abhijeet said: "This error is sometimes generated when you try to run a project created using an older version of Flutter than the one you're currently using." is correct.
Causes
When a project is created with flutter create foo several files in the ios/ and android/ sub-directories are created.
Newer Flutter versions might generate these files a bit differently and projects created with older Flutter versions might cause issues.
to fix:
Supposing that your project is in c:\root_of_your_project\name_of_your_project
Delete the ios/ and android/ directories and go to root directory of your project with CMD, and:
c:\root_of_your_project\flutter create -a kotlin name_of_your_project
and
c:\root_of_your_project\flutter create -i swift name_of_your_project
I am trying to build my android app and am getting an error about the version of Gradle that is being used. When I make the change that is suggested and run the command again the change gets changed back causing it to fail again.
I have tried replacing all references to gradle-4.1-all.zip with gradle-4.10.1-all.zip and for some reason it keeps getting changed back at this location /gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip
Android Studio project detected
ANDROID_HOME=/Users/user.account/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
Where:
Build file '/Users/user.account/cordovaProjects/hybrid-base/platforms/android/CordovaLib/build.gradle' line: 41
What went wrong:
A problem occurred evaluating project ':CordovaLib'.
Failed to apply plugin [id 'com.android.library']
Minimum supported Gradle version is 4.10.1. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/user.account/cordovaProjects/hybrid-base/gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 0s
/Users/user.account/cordovaProjects/hybrid-base/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
Where:
Build file '/Users/user.account/cordovaProjects/hybrid-base/platforms/android/CordovaLib/build.gradle' line: 41
What went wrong:
A problem occurred evaluating project ':CordovaLib'.
Failed to apply plugin [id 'com.android.library']
Minimum supported Gradle version is 4.10.1. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/user.account/cordovaProjects/hybrid-base/gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 0s
I am able to get a build to work if I do a cordova platform remove android and then immediately cordova platform add android but as soon as I try to build a second time it fails
If for any reason you need a different version of gradle there is no need to edit any file, just set the CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL env var with value the url where to fin the gradle zip, for example
http://services.gradle.org/distributions/gradle-4.1-all.zip
I do not have any problem with version 4.1 ( win10, android platform 7.1.4 ).
After you set your desired gradle version, reset your project ( remove all plugin and all platforms and manual edits then reinstall ) and then try to build.
If the problem persist, to help you better, post the error and please specify which OS, cordova version and android platform version you are using.
As a rule of thumb, from my experience with cordova, when you think that the only way to set a certain configuration is to edit platform files, there is probably a proper way to do so ( for example to automatically sign the apk when build )
Been trying to debug this issue for hours! Tried many solutions online, none seems to be working.
Build properties not found for package Android SDK Platform 25
File /root/.android/repositories.cfg could not be loaded.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
>
Failed to find target with hash string 'android-25' in: /home/hisham/Android/Sdk
* 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: 39.749 secs
Error: /home/hisham/Desktop/Dev-PGDoc/ionic_app/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Failed to find target with hash string 'android-25' in: /home/hisham/Android/Sdk
How do I fix this?
Finally got it fixed! Not sure which one of the following fixed it though.
Change $ANDROID_HOME inside ~/.bashrc from ANDROID_HOME=$HOME/Android/Sdk to ANDROID_HOME=$HOME/Android/Sdk/platform-tools
Deleted version 25's folder inside platform-tools folder in the Sdk and installed version 25 again.
After doing the two above, restarted the system and I am now able to compile and build ionic app to .apk files.
PS : This might be just only in my personal computer, and you might be facing the same issue due to different issue. Hope this helps.
I am trying to generate an apk file from edit configurations / + / Gradle/ assemle but no file is generated. After editing the configurations, I tried to make project, rebuild and clean but there is nothing in the output folder. I also tryed to press Run but I get this error:
Executing tasks: [assemble]
Configuration on demand is an incubating feature. NDK is missing a
"platforms" directory. If you are using NDK, verify the ndk.dir is set
to a valid NDK directory. It is currently set to
C:\Users\steve\AppData\Local\Android\Sdk\ndk-bundle. If you are not
using NDK, unset the NDK variable from ANDROID_NDK_HOME or
local.properties to remove this warning.
NDK is missing a "platforms" directory. If you are using NDK, verify
the ndk.dir is set to a valid NDK directory. It is currently set to
C:\Users\steve\AppData\Local\Android\Sdk\ndk-bundle. If you are not
using NDK, unset the NDK variable from ANDROID_NDK_HOME or
local.properties to remove this warning.
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
What went wrong: Could not determine the dependencies of task ':library:apklib'.
Task with path 'packageReleaseJar' not found in project ':library'.
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.296 secs
Any idea what to do, to create apk file? I am a little lost.
I am using android studio 2.3.1 and gradle:2.3.1
For anyone who has the same problem, I was able to generate apk file from:
Build / Build Apk
I am trying to run a the react-native app that was used at F8 locally. I am following the instructions here: http://makeitopen.com/tutorials/building-the-f8-app/local-setup/
I have everything work correctly (I can go to http://localhost:8080/dashboard/apps and http://localhost:8080/graphql and see data and run queries)
However, when I try to run the builds for iOS and Android, I am running into errors.
Android Error:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/thisuser/f8app/android/app/build.gradle' line: 124
* What went wrong:
A problem occurred evaluating project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* 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 mins 4.006 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
iOS Error:
=== BUILD TARGET CodePush OF PROJECT Pods WITH CONFIGURATION Debug ===
Check dependencies
** BUILD FAILED **
The following build commands failed:
CompileC /Users/thisuser/f8app/ios/build/Build/Intermediates/Pods.build/Debug-iphonesimulator/react-native-fbsdk.build/Objects-normal/x86_64/RCTConvert+FBSDKSharingContent.o /Users/thisuser/f8app/node_modules/react-native-fbsdk/iOS/RCTFBSDK/share/RCTConvert+FBSDKSharingContent.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/F8v2.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
/Users/thisuser/f8app/node_modules/react-native/node_modules/promise/lib/done.js:10
throw err;
^
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/F8v2.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:464:13)
at Object.execFileSync (child_process.js:484:13)
at _runIOS (/Users/thisuser/f8app/node_modules/react-native/local-cli/runIOS/runIOS.js:82:32)
at /Users/thisuser/f8app/node_modules/react-native/local-cli/runIOS/runIOS.js:24:5
at tryCallTwo (/Users/thisuser/f8app/node_modules/react-native/node_modules/promise/lib/core.js:45:5)
at doResolve (/Users/thisuser/f8app/node_modules/react-native/node_modules/promise/lib/core.js:200:13)
at new Promise (/Users/thisuser/f8app/node_modules/react-native/node_modules/promise/lib/core.js:66:3)
at Array.runIOS (/Users/thisuser/f8app/node_modules/react-native/local-cli/runIOS/runIOS.js:23:10)
at Object.run (/Users/thisuser/f8app/node_modules/react-native/local-cli/cliEntry.js:96:13)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:88:7)
How do I make these work?
For android only
You will need to set Android SDK path like this and must have at least Android SDK Build-Tools Rev 23.0.1.