I'm running Jenkins locally on my mac and I can't seem to get Jenkins to download the Android SDK automatically. I'm not defining a path, and according to the documentation, Jenkins will auto download it. What am I missing here?
"The plugin will automatically download and install the Android SDK, if it's not already installed when a build starts."
Jenkin Log
[Gradle] - Launching build.
[workspace] $ /var/root/.jenkins/jobs/TestingBuild/workspace/gradlew clean
FAILURE: Build failed with an exception.
* Where:
Build file '/private/var/root/.jenkins/jobs/TestingBuild/workspace/app/build.gradle' line: 17
* 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: 19.418 secs
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
So two days later... problem solved. I had to place an instance of the android sdk at this location. /Users/Shared/Jenkins/Home/tools/android-sdk. I also set an Environment variable ANDROID_HOME with the same path. Here's a screenshot.
Related
I have started learning flutter. And was trying to integrate the firebase realtime database into my flutter project. But as soon as I added the dependencies to my build.graddle files of the android part I started to get this error.
Launching lib\main.dart on A37f in debug mode...
* Error running Gradle:
ProcessException: Process "C:\Users\Username
\Desktop\firebase_listview\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Username\Desktop\firebase_listview\android\app\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating project ':app'.
> ASCII
* 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
BUILD FAILED in 3s
Command: C:\Users\Username\Desktop\firebase_listview\android\gradlew.bat app:properties
It started when I added
apply plugin: 'com.google.gms.google-services'
to the bottom of the app level build.graddle
And This
classpath 'com.google.gms:google-services:4.3.2'
to my project level gradle file.
I have also added firebase_databasse dependency in the pubspec.yaml file for the flutter under dependencies
Try to change google services classpath
from
classpath com.google.gms:google-services:4.3.2
to
classpath com.google.gms:google-services:4.2.0
I am setting Jenkins (on Mac) to build React Native mobile app.
For iOS it uses Carthage (I have few experience with it). Carthage is installed on my machine, and I can build app from terminal with "yarn build:ios:e2e" command. But while running job on Jenkins I see that Carthage in not visible to Jenkins. I checked it by running "carthage version" command in "execute shell" section: it returns "carthage: command not found".
So question is how to make Jenkins use installed Carthage?
PS. Jenkins already can get code from my GitLab server and build Android with "yarn build:android:e2e"
Jenkins is installed to my MacOS machine, with Android studio, XCode.
yarn is included to Jenkins as NodeJS installation with package "yarn", there is env. varianble to Android SDK.
Jenkins can start building app (so, XCODE can be used by Jenkins), but there is some error while compiling (this not happens when I run build from terminal on my machine).
Log from Jenkins job:
+ carthage version
/Users/Shared/Jenkins/tmp/jenkins8157594811837633611.sh: line 2: carthage: command not found
To make carthage available to Jenkins, go to Manage Jenkins - Configure System
Then add environment variable:
name = PATH
value = $PATH:/usr/local/bin/
"/usr/local/bin/" - here carthage alias placed
I am using below configuration and trying to make Jenkins build but I am getting errors.
Note, I am able to make build successfully with command line.
My PC environments:
OS: ubuntu 14.04
Gradle version: 2.14.1.
Jenkins version: 2.25
Java version: java-8-openjdk-amd64
JENKINS BUILD ERRORS:
[workspace] $ /bin/sh -xe /tmp/hudson2322559356105735311.sh
+ cd /home/ekambaramv/Jenkins/workspace/CARMODE_STAR_O-OS/MAIN/
+ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
+ GRADLE_USER_HOME=/home/ekambaramv/Jenkins/gradle-2.14.1/
+ /home/ekambaramv/Jenkins/gradle-2.14.1/bin/gradle clean build
**FAILURE:** Build failed with an exception.
* What went wrong:
Failed to load native library 'libnative-platform.so' for Linux amd64.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Build step 'Execute shell' marked build as failure
Finished: FAILUR
E
I've had similar problems with the JNI libary when using Gradle. It's possible you might be using a version of the JNI library that is incompatible with Gradle.
Try going to the site: https://debian.pkgs.org/9/debian-main-amd64/libnative-platform-jni_0.11-5_amd64.deb.html and downloading the libnative-platform-jni_0.11-5_amd64.deb package onto your machine.
You can either open Nautilus and right click the .deb package and select 'Open with Software Install', or you can navigate the command line to the download directory and run the following:
sudo apt-get install ./libnative-platform-jni_0.11-5_amd64.deb
Next, check to see if Gradle still gives you the same "Failed to load native library..." error message as before by running:
gradle --version
If the problem persists, and you still get the error message, you might want to consider upgrading to a later version of Gradle. I was able to get this working on Gradle 3.2.1, but I know this method isn't always possible.
If you need to back out the changes, just run another sudo apt-get update, and the JNI libraries will be overwritten with the latest version once more.
One More Thing
I mentioned the libraries get overwritten the next time you update your system (apt-get, Software Updater). To prevent this, run the following command:
sudo apt-mark hold libnative-platform-jni
This will force the update software to overlook any later versions of the library. To turn this off, run the opposite command:
sudo apt-mark unhold libnative-platform-jni
What went wrong:
A problem occurred configuring project ':app'.
You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 23.0.3].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
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: 4 mins 22.387 secs
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Archiving artifacts
Finished: FAILURE
I get this error when I build on jenkins on my windows machine. So how could I accept the license and fix the above issue
Have you tried using the new sdkmanager to update your SDK? You just have to run it once on the machine in question to accept the license for a given version.
https://developer.android.com/studio/command-line/sdkmanager.html#usage
You can also use the GUI which comes alongside this tool. See the following question for more information:
https://superuser.com/questions/1161536/android-bat-brings-up-sdk-manager-gui-why-is-sdkmanager-bat-needed
I'm trying to setup Jenkins to compile an iOS Xcode project. The xcode project uses CocoaPods. However, I get this error in Jenkins when I attempt a build. All files in the Pods/ directory have full write/read/execute permissions. Any thoughts?
/bin/sh -c /Users/Shared/Jenkins/Library/Developer/Xcode/DerivedData/MyApp-dripdwqnufuksvhcfgcgxajaahyq/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-EAAE77068BA044C9B06632CE.sh
/Users/samy/Work/mobile/iphone/MyApp/Pods/Pods-resources.sh: line 5: /Users/samy/Work/mobile/iphone/MyApp/Pods/resources-to-copy-MyApp.txt: Permission denied
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Copy\ Pods\ Resources /Users/Shared/Jenkins/Library/Developer/Xcode/DerivedData/MyApp-dripdwqnufuksvhcfgcgxajaahyq/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Script-EAAE77068BA044C9B06632CE.sh
(1 failure)
Build step 'Xcode' marked build as failure
Finished: FAILURE
"Full read/write/execute permissions" for whom? Which user? Jenkins usually runs under it's own user, called jenkins
The only workaround I came across was to move the entire Xcode project to jenkins user directory.
You might want to add a custom build setting PODS_ROOT
PODS_ROOT=$(PROJECT_DIR)/Pods