Jenkins unable to locate files on my computer - android

when ever I try to build my android project on jenkins it fails by saying :
Started by user anonymous
Building in workspace /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2
[mysteryshopper_version2] $ ant -Dlabel=trial1-9 clean debug
Buildfile: /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml
BUILD FAILED
/home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml:90: Cannot find /home/tanzeelrana/android-sdk-linux/tools/ant/build.xml imported from /home/tanzeelrana/git/eventmatrix-cordova-app/mysteryshopper_version2/build.xml
Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
on line 90 in my build.xml file I have a tag with the following in it :
import file="/home/tanzeelrana/android-sdk-linux/tools/ant/build.xml"
does anyone know why it is unable to locate this file ? the file exist at the exact path ....

Jenkins usually runs with its own user (jenkins),
so it is probably an issue of permissions.
Try printing the current user from within your Jenkins job.
EDIT:
See here about running Jenkins as a daemon -
it also shows how to set it to run as a different user than 'jenkins':
Installing Jenkins as a Unix daemon

Related

Errors when building : no source map reference + remove sentry-cordova exited with exit code 1

I'm trying to build my ionic app for android and most users have a white screen after the splashscreen. I've past the past week to try to determine where it could come but got no idea... So I'm trying to get rid of all the errors I have when building. (it still succed to build with the errors and worked on almost half phones).
First one is here :
Building for Android...
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd plugin remove sentry-cordova exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
> cordova.cmd plugin remove sentry-cordova Sentry: running before_plugin_rm - set SENTRY_SKIP_WIZARD=true to skip this angular.json build.json build_android.sh build-extras.gradle CertificateSigningRequest.certSigningRequest
...
tslint.json www Uninstalling sentry-cordova from android Subproject Path: CordovaLib Subproject Path: app Uninstalling sentry-cordova from browser js-module uninstall called : plugins\sentry-cordova\dist\js\sentry-cordova.bundle.js Uninstalling sentry-cordova from ios Removing "sentry-cordova" Removing sentry-cordova from package.json doc.find is not a function
Second one is after, there is multiples lines like this :
- warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/1-es5.1922
I'm pretty sure I miss some informations. Don't hesitate to ask if necessary but I'm sure I forget to do something, but i'm kinda desperate now...
EDIT : Here is the begining of the script I'm using for build :
echo "Building for Android..."
#npm run android:build:prod
sentryRemove=$(ionic cordova plugin remove sentry-cordova)
echo $sentryRemove
sentryAdd=$(cordova plugin add sentry-cordova)
echo $sentryAdd
echo "successfully added the sentry. \n Performing build now."
appBuildOut=$(ionic cordova build android --prod --release --source-map)
echo $appBuildOut
BUILD_MESSAGE='BUILD SUCCESSFUL'
Thanks for your help
The first question is why are you running a plugin remove command when building your app, if I understand correctly. I would check what is calling this command because the script that is erroring before_plugin_rm should only be called when the plugin is being removed.
To get this script to just work, try running with the environment variable SENTRY_SKIP_WIZARD=true and see if the build works. I don't think the reason for the white screen is related to Sentry as the step that is failing looks to be related to source map uploading.

java.lang.IllegalArgumentException: Error: Failed to parse APK file:

I have search stockoverflow and google with no luck. I recently migrated my app to androidx, after a lot of effort I was able to fix all the build fails. but now I am getting the following error when the app is installing on the emulator or the device. any help will be highly appreciated.
I have tried the following:
invalidate caches/restart
clean build and rebuild project
uninstalled app from the device
restarted my pc
Exception occurred while executing:
java.lang.IllegalArgumentException: Error: Failed to parse APK file: /data/local/tmp/...
at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:338)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:906)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:158)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21328)
at android.os.Binder.shellCommand(Binder.java:634)
at android.os.Binder.onTransact(Binder.java:532)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2821)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3856)
at android.os.Binder.execTransact(Binder.java:731)
Caused by: android.content.pm.PackageParser$PackageParserException: Failed to parse /data/local/tmp/...
at android.content.pm.PackageParser.parseApkLiteInner(PackageParser.java:1590)
at android.content.pm.PackageParser.parseApkLite(PackageParser.java:1575)
at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:331)
... 9 more
$ adb shell pm uninstall ...
Unknown failure (at android.os.Binder.execTransact(Binder.java:731))
Error while Installing APK
Delete the previous app-release.apk file from the android folder:
\app\build\outputs\apk\release
Then clear all data from the emulator. Finally, rebuild the application.
Clean -> Rebuild -> and try to check both v1 and v2 while generating apk file
You should drop the cache on your mobile.
for example:
1- open your windows terminal on your computer
2 - enter the command >adb shell
you should be insite on your mobile
3 - enter to the tmp/appium_cache/ folder with >cd data/local/tmp/appium_cache
4 - write the command >ls to see all the elements that there is insite of that folder
5 - drop all that elements with the command >rm filename
hope to help you
just delete build folder and run again
android/app/build

CODE-PUSH unable to release on VSTS

While trying to release via code-push on VSTS getting the following error:
Unable to find or read "config.xml" in the CWD. The "release-cordova" command must be executed in a Cordova project folder
2017-11-21T09:22:35.1120732Z [Error] Unable to find or read "config.xml" in the CWD. The "release-cordova" command must be executed in a Cordova project folder.
2017-11-21T09:22:35.1200947Z ##[debug]Finished Building Command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli logout
2017-11-21T09:22:36.2276558Z ##[debug]task result: Failed
2017-11-21T09:22:36.2295997Z Command failed: release-cordova
2017-11-21T09:22:36.2326120Z ##[debug]Processed: ##vso[task.complete result=Failed;]Command failed: release-cordova
Here's the screenshot attached of the problem:
For the detailed log: https://drive.google.com/open?id=1SMk0N47A8OGm5PDUk5e86sPygmMAjD5X
In order to trouble shooting for this error:
Please add two tasks before CodePush task:
1) Add npm task with this setting
https://drive.google.com/open?id=1H4bWAMruzfOs90xOLxgjadAd7DihaVH4
2)After npm task, add Command Line task with below setting
https://drive.google.com/open?id=1bxd54kVgW4zGRwhsH_JKz_cjc1wYZ-No
Then check if the Cordova command can execute correctly
Then if you have specified the variable Build.SourceDirectory
as $(Build.SourcesDirectory)\path to your app
remove it (the variable) as you have already specified the path in GET SOURCES
You do not need to add the “Build.SourceDirectory” variable in this condition. And now, you specified the working directory to “d:\a\3\s\app path” which should not exist on the build agent, but the task didn’t report that error.
The task indicated that it cannot find the config.xml since the file exist under “d:\a\3\s” rather than “d:\a\3\s\app path”.
Thus remove the “Build.SourceDirectory” variable and run the build to check
The above steps should work for the given problem

Unable to determine the workspace. You may be able to correct this by running

I try to build apk file in my tfs server. When i run build, after 5 minutes tfs server tell me that my apk file was build and status ok, byt in folder not apk file , in folder only my logs.
Run build_APK.bat
F:\Android\projects\Mrdoc\TeamBuildTypes\mobile_v3R\\build_APK.bat "\\tfb\storage\mobile v3r_1.7\"
Get last version in TFS Server...
Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
Enviroment initializing...
The system cannot find the path specified.
Assembling...
Deploing path:"\\tfbd\storage\mobile v3r_1.7\"
The command "F:\Android\projects\Mrdoc\TeamBuildTypes\EOSmobile_v3R\\build_APK.bat "\\tfb\storage\mobile v3r_1.7\"" exited with code 1.
I ran the command 'tf workspaces /collection:TeamProjectCollectionUrl'
and I saw all users but it did not help me.
Overall Build Process
Get the Build
Update Build Number
Run On Agent Default Agent - test1
Get the Build Directory
If Not String.IsNullOrEmpty(ConfigurationFolderPath)
Run TfsBuild for Configuration Folder
Getting sources
Labeling sources
Generating list of changesets and updating work items
Выполнена сборка $/Doc/TeamBuildTypes/mobile_v3R/TFSBuild.proj для целевых объектов CompileConfiguration.
MSBuild Log File
If CompilationStatus = Unknown
Set CompilationStatus to Succeeded
If TestStatus = Unknown
Set TestStatus to Succeeded
First if your build service was registered with network service. Give a try with changing it to a windows user with enough build permission.
Moreover, please make sure you have a workspace mapping for your build computer and for the windows account under which build agent runs.
Take a look at this similar issue: Team Build, fixing the "Unable to determine the workspace" error

Gradle in Android Studio 0.44 can't find process on path to run in an Exec Type task

I used to have the following gradle build task:
task buildWebApp(type: Exec) {
executable = Os.isFamily(Os.FAMILY_WINDOWS) ? "grunt.cmd" : "grunt"
args = ["build"]
}
This would pick the appropriate grunt command and run it with the argument "build".
This worked without any kind of issue
I've just tried this in Android Studio 0.4, using Gradle 1.9 and it's no longer working. Instead I get the following error:
Execution failed for task ':BrowserPages:buildWebApp'.
A problem occurred starting process 'command 'grunt''
Normally at this point I would debug with gradlew, but running the following command, throws no errors:
$ ./gradlew buildWebApp
I've also tried running the full task list to still not find any problems.
The way this is executed is from my main build.gradle file with this dependency
copyWebApplication.dependsOn ':BrowserPages:buildWebApp'
Anyone have any ideas?
I've tried to run executable = "node" with arg = ["-v"] and get the same error where it can't find node. Node is globally accessible on my terminal, so I can only assume that the command is being run in a different environment to the terminal. There is the option for setting the environment but I can't find any examples of how it should be used.
Try using a fully-qualified path to the grunt executable. Perhaps something in the path has changed between Android Studio/Gradle/Android Plugin versions.

Categories

Resources