I am trying to use the bitbucket pipeline to upload my build apk to hockey app but when i try to run my script i get
bash: ./deploy-hockey-dev.sh: Permission denied
this is the deploy-hockey-dev.sh :
#!/bin/sh
# upload apk to hockey app
curl \
-F "status=2" \
-F "notify=0" \
-F "ipa=#app/build/outputs/apk/debug/app-debug.apk" \
-H "X-HockeyAppToken: myToken" \
https://rink.hockeyapp.net/api/2/apps/upload
Does any one know what the problem here is ?
The issue is that the file was not given the correct execution permissions before it was checked into BitBucket.
If you are developing locally in a unix environment, you would normally set execute permissions (ie. chmod 755) on the script file so you can test it locally before committing. With this approach you would not experience the permission denied error in pipeline build when you check it in.
However, sometimes we are authoring our scripts on Windows without a unix emulator, so we can only test our scripts in a pipeline environment. Even though Windows does not support execute permissions in its file system, we can still use git to show and set these execute permissions.
cd <dir-with-shell-scripts>
git ls-files --stage # show file permissions (last 3 digits of first number)
git update-index --chmod=+x <files> # set execute permissions
Commit the updated files as per your normal process.
It turns out that right before i execute the script i had to use - chmod +x deploy-hockey-dev.sh so the .yml file that is used in bitbucket should have this line before the execution of the script. I made a tutorial of how to make the entire process hope it help some one.
This looks like Linux permissions problem to me rather than programming. Check if the script has executable permission (the x bit in ls -l). You can consult chmod (man chmod) or the Internet for details how Linux permissions work, as I believe that is offtopic for this site.
This worked for me.
In your code terminal, you need to update the permissions for the files to be executable (x in them)
chmod +x path/to/file
Then commit and push. The pipeline should pass for this issue
Related
I am running linux mint 17.2, I have repo installed and the path to repo is added to my .bashrc. I have previously initiated my repo.
I have followed the instructions on the Android Source Downloading and How to Build CyanogenMod pages.
The problem is: I have written a bash script to automate a number of the commands I would like to use to start a build. My script in a simple form is the following:
#!/bin/bash
cd ~/Android/Cyanogenmod/cm12_1/android/system
source build/envsetup.sh
repo sync --force-sync -j8
exec $SHELL
When I run this, it reports:
/home/username/Desktop/Cyanogenmod_cm12_1_Grouper_Build : line 4 repo: command not found
If I copy and paste each line into a fresh terminal instance (or by just running a script of #!/bin/bash exec $SHELL to open a terminal) it works perfectly.
What I have tried: I have tried including a sleep 10 before the repo sync --force-sync -j8 but that made no difference. I have also tried explicitly initiating the repo and force adding it to my PATH for the current terminal session directly before attempting the repo sync --force-sync -j8. The code for that test was the following:
#!/bin/bash
mkdir -p ~/Android/Cyanogenmod/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/Android/Cyanogenmod/bin/repo
chmod a+x ~/Android/Cyanogenmod/bin/repo
cd ~/Android/Cyanogenmod/cm12_1/android/system/
source build/envsetup.sh
PATH=~/Android/Cyanogenmod/bin/repo:$PATH
repo sync --force-sync -j8
exec $SHELL
The following 2 questions have a similar title, but neither are my question, this and this.
Any help or suggestions would be great, thank you!
To summarize, there turned out to be 2 problems. The first, was in my attempted solution of manually setting the path in the script as PATH=~/Android/Cyanogenmod/bin/repo:$PATH should have been just PATH=~/Android/Cyanogenmod/bin:$PATH.
The second, and overall larger problem, was an incorrectly added PATH variable (to repo) in my .bashrc. This was fixed by adding the line export PATH=$PATH:$HOME/Android/Cyanogenmod/bin to the end of my .profile, followed by logging out/in.
I updated Nexus 7 with Android Lollipop and now i can't access SQLite db from IntelliJ IDEA 14. Everything was working fine before Lollipop update, even though Android wasn't rooted i could access db from IntelliJ (but not pull it via ADB).
The error i am getting when i try to connect is:
Data Source Synchronization Error
Cannot synchronize 'SQLite': run-as: exec failed for /data/local/tmp/intellij_native_tools/get_modification_time Error:Permission denied
I am aware that SQLite was updated in lollipop from 3.7 to 3.8. What could cause this kind of error? Wrong DB creation, old DB drivers, something else?
adb root doesn't resolve anything, there's numerous issues depending on environment. Here's how I got it working on emulator where I spend a lot of my development time.
First we need to resolve the error only position independent executables (PIE) are supported with the binary.
get the source of android ultimate plugin tool:
git clone https://android.googlesource.com/platform/tools/adt/idea
cd idea/android/ultimate/get_modification_time/jni
Apply the following patch:
diff --git a/android/ultimate/get_modification_time/jni/Application.mk b/android/ultimate/get_modification_time/jni/Application.mk
index a252a72..bdf815d 100644
--- a/android/ultimate/get_modification_time/jni/Application.mk
+++ b/android/ultimate/get_modification_time/jni/Application.mk
## -1 +1,2 ##
APP_ABI := all
+APP_PLATFORM := android-16
You'll need to setup a recent version of NDK to build, I had ndk-r10d installed already.
# ndk-r10d
ndk-build
cd ..
cp -R libs native_tools
# update the intellij plugin with whatever arch you plan to use
# adjust the path here to where your copy of IntelliJ is located
zip -u ~/local/apps/idea/plugins/android/lib/android-ultimate.jar native_tools/*/get_modification_time
Note that you need to update the path in that last line to point to your local IntelliJ installation. For example, on MacOS, it'll be:
zip -u /Applications/IntelliJ\ IDEA\ 14.app/Contents/plugins/android/lib/android-ultimate.jar native_tools/*/get_modification_time
Restart IntelliJ.
Next, we'll be replacing /system/bin/run-as on the emulator. Create the following script locally and name it run-as.
#! /system/bin/sh
INTELLIJ_NATIVE="/data/local/tmp/intellij_native_tools/get_modification_time"
if [ "$2" = "$INTELLIJ_NATIVE" ]; then
cd /data/local/tmp/intellij_native_tools
./get_modification_time "$3"
else
/system/bin/run-as.org "$#"
fi
Start the emulator. After it has booted, update it.
# update run-as after start
adb shell mount -o remount,rw /system
adb shell mv /system/bin/run-as /system/bin/run-as.org
adb push ./run-as /system/bin/run-as
Now you can synchronize to your heart's content.
Note, you may also want to follow progress on the bug upstream which just had priority bumped after posting this: https://youtrack.jetbrains.com/issue/IDEA-137606
If you have a rooted device try command
adb root
After it IDEA synhronization is successfull.
I made a script to clean a ROM and install specific apps but when I look in the folder Mac is not seeing my .apk as unix exec file how can i fix this
here is part of the script:
getapex='curl -s -o ApexLauncher.apk apex.anddoes.com/Download.aspx'
$getapex
mv ApexLauncher.apk $currentdir/system/app/
hope you guys can help....
If it's not seeing the .apk file as a "unix exec file" as you say, then maybe you need to give it execution permission with:
chmod +x ApexLauncher.apk
I was trying to run cocos2dx HelloCpp sample project on Android, building from Windows-7 64 bit with Cygwin 64 bit, however, everytime I try to build and run, it complains that permission was denied on "Marker Felt.fnt" file in assets/font folder.
I checked that there's no permission on that file and chmod to give it proper permission, but everytime I try to run again, that file seems to be regenerated and has no permission again...
Does anyone has the same problem? I have been googling and the nearest problem I've found is this:
Cocos2dx Android: Get data from file(assets/*) failed
However, it is quite different. I've tried disabling UAC on my Windows machine, but the problem doesn't go away
Any help is highly appreciated
Check the proj.android/build_native.sh, every time you run the build, the entire assets/* folder will be re-created, and thus, your chmod is nullified.
You can chmod after the copy process itself in the build_native.sh, place the chmod somewhere after cp the assets/*
in my case, put
chmod 777 -R "$APP_ANDROID_ROOT"/assets
after copying the assets folder in build_native.sh like this:
if [ -f "$file" ]; then
cp "$file" "$APP_ANDROID_ROOT"/assets
fi
chmod 777 -R "$APP_ANDROID_ROOT"/assets
done
I am new to git and repo. I am in window 7 so I use cygwin. I have installed git from cygwin setup. After that I try to repo with the following command in cygwin.
$ repo init-u git://android.git.kernel.org/platform/manifest.git
I get an error like these:
bash: repo: command not found
I think I need to setup cygwin for repo. What do I need next to get repo?
Case 1: Not installed google repo yet?
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Use the following checksums when required:
For version 1.25 it is
d06f33115aea44e583c8669375b35aad397176a411de3461897444d247b6c220
For version 1.26, it is 0cf5f52bcafb8e1d3ba0271b087312f6117b824af272bedd4ee969d52363a86b
Case 2: Already have google repo Installed, still wondering what went wrong ?
Add
PATH=~/bin:$PATH to the end of file ~/.bashrc
and then run
source ~/.bashrc
You still need to install repo. repo is a third party tool built on top of git. See:
http://source.android.com/source/downloading.html
for how to install
I have the same problem and I have to do:
$ PATH=~/bin:$PATH every time I repo sync but at least it works.
add line
export PATH=~/bin:$PATH in file ~/.bashrc
edit .bash_profile and uncomment these fields. (any text editor will do)
# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
# PATH="${HOME}/bin:${PATH}"
# fi
Restart CYGWIN.
Check and see if you have both .profile & .bash_profile in the working directory.
If you do, it's possible that the export command in both is actually conflicting in your shell. Making the output look something like this in Windows...
PATH="C:/Windows/path/to/repo/Windows/path/to/repo:$PATH"
export PATH
That's what happened to my bash shell anyway. It is correct that the 2 files interact with Bash or Cygwin differently, however if you have redundant inputs, they will compile together...
This answer for android build system error
For Python 3
If you get a "/usr/bin/env 'python' no such file or directory" error message, use one of the following solutions:
If your Ubuntu 20.04.2 LTS is a newly installed (vs. upgraded) Linux version:
sudo ln -s /usr/bin/python3 /usr/bin/python
f using Git version 2.19 or greater, you can specify --partial-clone when performing repo init. This makes use of Git's partial clone capability to only download Git objects when needed, instead of downloading everything. Because using partial clones means that many operations must communicate with the server, use the following if you're a developer and you're using a network with low latency:
repo init -u https://android.googlesource.com/platform/manifest -b master --partial-clone --clone-filter=blob:limit=10M
you can see document in
Downloading the Source