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)
Related
I'm running AAPT2 from the command line:
%PATH_AAPT2%\aapt2.exe compile -v --dir res -o build
Many resource files are compiled. But after a time aapt2 is aborting with the message
Check failed: node_stack.size() == 1u
The build output is:
>C:\Android\aapt2\aapt2.exe compile -v --dir res -o build
res\color\button_back.xml: note: compiling XML.
...
res\drawable\rectangle.xml: note: compiling XML.
res\drawable\row.xml: note: compiling XML.
res\drawable\splash_screen.xml: note: compiling XML.
res\menu\menu_main.xml: note: compiling XML.
aapt2.exe F 08-23 07:52:20 16152 15008 ResourceParser.cpp:346] Check failed: node_stack.size() == 1u
What is the reason?
The used AAPT2 version is 4.1.0 rc01, but the error occurs with other versions too.
The error seems not to be related to any resource. I removed the recently compiled resources like menu_main.xml, but the error occurs furthermore.
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 try to use Android Studio to build native c++ project using cmake 3.14.0 version. Like in documentation: https://developer.android.com/studio/projects/add-native-code#use_a_custom_cmake_version . So I add version "3.14.0" to my build.gradle and add cmake.dir=C\:\\CMakeWin32 to my local.properties about vanilla cmake.
And then:
> Task :UnitTests:generateJsonModelArmDebug
> Task :UnitTests:generateJsonModelArmDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':UnitTests:generateJsonModelArmDebug'.
> Illegal char <:> at index 47: C:/j/client/dava.framework/Programs/UnitTests\C:/r15c/sources/android/cpufeatures/cpu-features.c
If I use default cmake 3.6 in NDK bundle all works. My environment is:
Windows - 10
Android Studio - 3.4.1
gradle - try 4.10.1 and 5.4.1
ndk - try 15c and 19c
In my CMakeLists.txt I add dependency:
add_library( ${PROJECT_NAME} SHARED ${PLATFORM_ADDED_SRC} ${REMAINING_LIST} )
include(AndroidNdkModules)
android_ndk_import_module_cpufeatures()
target_link_libraries( ${PROJECT_NAME} cpufeatures)
I understand from error message full path to C:/r15c/sources/android/cpufeatures/cpu-features.c gradle want's to concatenate with path to current project C:/j/client/dava.framework/Programs/UnitTests. I think problem with gradle and how it use cmake_server to generate json code model. But how to fix it? Thanks in advance.
Update(more info):
If I build like: C:\j\client\dava.framework\Programs\UnitTests\Platforms\Android>gradlew :UnitTests:generateJsonModelArmDebug --info > log.txt 2>&1
in log file copy responce from cmake server and save it in file test.json
open test.json in Firefox and see target libcpufeatures.a in source section has full path to one source file.
sourceDirectory remainse from parent project C:/j/client/dava.framework/Programs/UnitTests
so I think gradle try to combine this two together bug in cmake or in gradle work with json responce from cmake.
Bug was in google gradle plugin so I just upgrade it and it works with new cmake 3.14.
Just update your gradle plugin:
dependencies { classpath 'com.android.tools.build:gradle:3.4.1' }
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?
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.