I cannot perform the gradle init command in the directory of the project: the command line show this error :
gradle is not recognized as an internal or external command,
operable program or batch file
should I insert gradle as an environmental variable ? if so, how?
Related
I am trying to build my React Native Android app on Visual Studio App Center and I get this error:
Task : Shell script
Description : Run a shell script using Bash
Version : 2.165.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/shell-script
==============================================================================
[command]/bin/bash /Users/runner/runners/2.165.2/scripts/android-postprocess.sh /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk
Removing all ABI or density dependent APKsā¦
find: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk: No such file or directory
find: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk: No such file or directory
find: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk: No such file or directory
Found 0 APK file(s)
Found 0 unaligned APK file(s)
find: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk: No such file or directory
/Users/runner/runners/2.165.2/scripts/android-postprocess.sh: line 36: pushd: /Users/runner/runners/2.165.2/work/1/s/mobile/android/app/app/build/outputs/apk/..: No such file or directory
/Users/runner/runners/2.165.2/scripts/android-postprocess.sh: line 43: popd: directory stack empty
##[error]The process '/bin/bash' failed with exit code 1
##[error]Bash failed with error: The process '/bin/bash' failed with exit code 1
##[section]Finishing: Android Postprocess
##[section]Starting: Post Build Script
It's incorrectly looking for my APK in the app/app/build/... instead of app/build/...So I want to copy the files to app/app/build/.. so it finds them there.
I can't copy the files with a post-build script because it runs after the script that throws the error.
Is it possible to somehow achieve copying with Gradle? Or maybe have multiple build paths? Or some other solution?
The problem was that I had gradlew, gradlew.bat and gradle folder in my appmodule folder. I must have mistakenly opened the app folder alone in Android Studio and synced the project.
I solved it by creating a fresh React Native project.
I am using native code in the android project seems the last 1.5 years. but today suddenly android studio shows below error.
Build command failed. Error while executing process
D:\Android\sdk\ndk-bundle\ndk-build.cmd with arguments
{NDK_PROJECT_PATH=null
APP_BUILD_SCRIPT=D:\Android_Project\CLONE\xyz\app\src\abc\jni\Android.mk
APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1
APP_PLATFORM=android-16
NDK_OUT=D:/Android_Project/CLONE/Separate_Apps/xyz/app/build/intermediates/ndkBuild/abc/debug/obj
NDK_LIBS_OUT=D:\Android_Project\CLONE\Separate_Apps\xyz\app\build\intermediates\ndkBuild\abc\debug\lib
APP_CFLAGS+=-DDEBUG APP_SHORT_COMMANDS=false
LOCAL_SHORT_COMMANDS=false -B -n}
'"D:\Android\sdk\ndk-bundle\build\..\prebuilt\windows-x86_64\bin\make.exe"'
is not recognized as an internal or external command, operable program
or batch file.
I have tried too many solutions but it doesn't work.
After too much research on this issue finally, I got a solution.
Step: 1
Update build:gradle version
USE
classpath 'com.android.tools.build:gradle:3.6.1'
INSTEAD OF
classpath 'com.android.tools.build:gradle:3.4.2'
Step: 2
Update Android NDK Location in project Structure
USE
D:\Android\sdk\ndk\21.0.6113669
INSTEAD OF
D:\Android\sdk\ndk-bundle
Note: Install and configure the NDK and CMake
Step: 3
finally, sync project.
deleting this part from build.gradle file works for me:
externalNativeBuild {
cmake {
path 'tools/CMakeLists.txt'
}
}
I'm trying to including the NewRelic library into my project, but I get this error when I build it
Error:Execution failed for task ':v1:preDexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files\Android\android-studio\sdk\build-tools\19.1.0\dx.bat --dex --output
C:\Documents and Settings\t.hart\My Documents\Android\MoneyTracker\v1\build\pre-dexed\debug\android-agent-3.378.0-27125f93a249f513379e837d75ebec255f6dcaa4.jar
C:\Documents and Settings\t.hart\.gradle\caches\modules-2\files-2.1\com.newrelic.agent.android\android-agent\3.378.0\1ebf0e20081a7f1b9a5c31bfc4e7dba776e0c171\android-agent-3.378.0.jar
Error Code:
1
Output:
Error opening zip file or JAR manifest missing : C:\Documents
To include the library you need to add 3 lines to your build.gradle files,
//This to the buildscript dependancies
classpath 'com.newrelic.agent.android:agent-gradle-plugin:3.378.0'
//This line (in the example it's under the android line
apply plugin: 'newrelic'
//And this to dependancies
compile 'com.newrelic.agent.android:android-agent:3.378.0'
After some trial and error it seems it's the last line (the compile one) that's causing the error to be thrown. Is this because of the spaces in C:/Documents And Settings?
I'm also using these librarys, and they all downloaded to the build/pre-dexed/debug folder fine with no issues.
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:gridlayout-v7:19.1.0'
compile 'com.android.support:support-v4:19.1.0'
EDIT: Updated error message
Error:Execution failed for task ':v1:preDexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files\Android\android-studio\sdk\build-tools\19.1.0\dx.bat --dex --output
C:\MoneyTracker\v1\build\pre-dexed\debug\support-v4-19.1.0-cd41ef807caadb29c9df0131dee869d3723185ad.jar
C:\Program Files\Android\android-studio\sdk\extras\android\m2repository\com\android\support\support-v4\19.1.0\support-v4-19.1.0.jar
Error Code:
1
Output:
Error opening zip file or JAR manifest missing : C:\Documents
Now that's a strange error...
It effectively has to do with spaces in your folders names, the error message tells you gradle can't find a zip or jar manifest in C:\Documents, which is obviously not the folder your newrelic library is in. Try moving your project in a directory which name doesn't have space. Make it a habit, some tools really don't like spaces in filenames (especially unix rooted one).
You can set the GRADLE_USER_HOME environment variable, gradle.user.home system property, or --gradle-user-home command line parameter to directory which name doesn't have space.
(via How to change Gradle download location)
i have already refer these links...
http://stackoverflow.com/questions/20241637/where-i-can-get-cordava-3-2-jar-file
http://cordova.apache.org/docs/en/3.2.0/guide_platforms_android_webview.md.html
This is my comand prompt o/p :
What should I do...
E:\Android Installation\cordova-3.2.0-src\cordova-3.2.0\cordova-android\framewor
k>android update project -p . -t android-18
'android' is not recognized as an internal or external command,
operable program or batch file.
It is because windows is unable to find the program android.bat or android.exe or whatever it is what you need to do is edit your PATH environmental variable and set it to the folder containing the file ,The file is probably at android-sdk/tools/ directory goto your android sdk installation directory/tools copy the path and in the command prompt typeset PATH="<the path you've just copied>"
I Want to build apk using commandline, I am using ant server by using it I am building apk with commandline but when I give this command ant debug it shows error BUILD FAILED Unable to locate tools.jar and then it gives error source resource doesnt exist
This might be because your JAVA_HOME is not set to your C:\Program Files\Java\jdk folder.
instead it might be set to C:\Program Files\Java\jre so it's not getting tools.jar.
just check out this.
You can do this in this way:
C:\>set JAVA_HOME=C:\Program Files\Java\jdk
C:\>ant debug
You need tools.jar file from your jdk/lib/ folder.