Download and moving .apk with bash - android

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

Related

Permission denied from Bitbucket pipeline

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

Android NDK Installation on ubuntu

I downloaded the latest ndk from http://developer.android.com/tools/sdk/ndk/index.html#Installing.
For installing the ndk i used the following command in the terminal.
chmod a+x android-ndk-r10c-darwin-x86_64.bin
It returned saying chmod: cannot access `android-ndk-r10c-darwin-x86_64.bin': No such file or directory
Please help!
It's android-ndk-r10d-linux-x86_64.bin. if you are using ubuntu 64 bit version, you should download linux-x86_64.bin one. darwin is for Mac OS X, if you have downloaded the right file, use this command
chmod a+x android-ndk-r10d-linux-x86_64.bin
Please set Path on Command android-ndk-r10c-darwin-x86_64.bin is placed
and run this line like:
C:\User\folder Name of android-ndk-r10c-darwin-x86_64.bin placed\
chmod a+x android-ndk-r10c-darwin-x86_64.bin

How do I execute a shell file?

I'm trying to download Whatsapp on my laptop. I am using Ubuntu desktop software. I've installed Android Emulator from http://dl.google.com/android/android-sdk_r16-linux.tgz
I unzipped the file, opened the folder, Android-sdk-linux, opened Tools and now I'm supposed to execute the file Android, and I'm not sure how to do that. Can anyone give me any help?
Ok, so this is what I thought I was supposed to do:
shell#shell:~$ cd Desktop
shell#shell:~/Desktop$ ./android.sh
bash: ./android.sh: No such file or directory
but then that happens...
Make the file executable first with
chmod +x filename.sh
Then start the script with
./filename.sh
or
/full/path/to/filename.sh
sh filename.sh
OR
bash filename.sh
Use the following command to install the WhatsApp on Ubuntu:
wget https://www.thefanclub.co.za/sites/all/modules/pubdlcnt/pubdlcnt.php?file=https://www.thefanclub.co.za/sites/default/files/public/downloads/whatsapp-webapp_1.0_all.deb&nid=200 && sudo dpkg -i whatsapp-webapp_1.0_all.deb
Then enter the password and open WhatsApp using the application key.
by default permission for any shell script is "-rw-rw-r--" first we need to change the permissions using the "chmod command" then we can run the shell script in the same way in which we run the C executable code.
To debug the shell script we need to run the shell script with the "bash -x" option as follow : $ bash -x ./

Running unix commands on windows cmd

i am currently trying to learn how to develop apps for android mobile phones using PhoneGap. i was able to get this book titled "PhoneGap 2x mobile application development". ths book is really nice and self explanatory but the problem i have is when the author want to create d project via the command line, he was using Unix commands because he is running a Unix PC. I am running Windows and to follow his commands using the CMD is a bit hard for me because i dont understand all of his commands.
Below was what he wrote:
mkdir $PROJECT_HOME
cd $PROJECT_HOME
mkdir Android iOS www
cd $PHONEGAP_HOME/lib/android/bin
./create $PROJECT_HOME/Android/QuizTime com.phonegaphotshot.
QuizTime QuizTime
cd $PHONEGAP_HOME/lib/ios/bin
./create $PROJECT_HOME/iOS com.phonegaphotshot.QuizTime QuizTime
cd $PROJECT_HOME
mkdir www/cordova
cp Android/QuizTime/assets/www/cordova-2.2.0.js www/cordova/
cordova-2.2.0-android.js
cp iOS/www/cordova-2.2.0.js www/cordova/cordova-2.2.0-ios.js
cd Android/QuizTime/assets
rm –rf www
ln –s ../../../www
cd ../../../iOS
rm –rf www
ln -s ../www
cd ..
cd www
cp –r $YASMF_DOWNLOAD/framework .
mkdir images models views style
cd ..
cd Android/QuizTime/src/com/phonegaphotshot/QuizTime
edit QuizTime.java
Change "index.html" to "index_android.html"
Save the file.
cd $PROJECT_HOME/iOS/QuizTime
can someone tell me how to do this on the windows cmd. i know what mkdir is but i need a total description and if possible a translation following that if you were to do this on a windows cmd.
I forgot to mention one simple fact. You CAN NOT RUN the unix commands over Windows DOS/CMD
check this link. It gives direct co-relation between dos and unix commands. hope this helps.
http://www.tldp.org/LDP/intro-linux/html/app2.html
or better still, check this
http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html
Once you get the different commands, guess it should not be hard for you to write it in DOS.
Note: The "create" command is part of phonegap/cordova apis..
Also, check this link: http://docs.phonegap.com/en/2.1.0/guide_command-line_index.md.html
Here is a snapshot of the code converted:
-- make directory ---
C:\> mkdir PROJECT_HOME
-- go to the directory you created ---
cd PROJECT_HOME
-- make directories inside ---
C:\PROJECT_HOME> mkdir Android
C:\PROJECT_HOME> mkdir iOS
C:\PROJECT_HOME> mkdir www
-- now navigate to the bin directory- ---
C:\PROJECT_HOME> cd \lib\android\bin
-- now you basically runn the create command, am hereby just putting in what you wrote ---
C:\PROJECt_HOME\lib\android\bin>create \PROJECT_HOME\Android\QuizTime com.phonegaphotshot.QuizTime QuizTime
----- do same for the ios------------
-------make dir for cordova -------
C:\PROJECT_HOME> cd www
C:\PROJECT_HOME\www> mkdir cordova
--then you have to copy the contents of one directory to another, to copy everyrthin in directory recursively, use xcopy-----------
C:\PROJECT_HOME> XCOPY Android\QuizTime\assets\www\cordova-2.2.0.js www\cordova\cordova-2.2.0-android.js
I know this is a quite old question but anyway, have you ever tried a terminal emulator? Try Console. It's a free terminal emulator for windows.
and to get to know what a command does type
man <command>
in the terminal.
The book "PhoneGap 2x mobile application development" is quite old. The phonegap/cordova development has changed quite a bit from 3x onwards. The current/latest version is 4x.
Below are the links pertaining to phonegap/cordova 3x which will work for 3x and 4x versions.
hope it helps.
http://thejackalofjavascript.com/phonegap-3-cli-setup-mac-windows/
http://coenraets.org/blog/cordova-phonegap-3-tutorial/
http://teusink.blogspot.in/2013/07/guide-phonegap-3-android-windows.html
http://sdk.revmobmobileadnetwork.com/phonegap_cordova.html
http://docs.phonegap.com/en/3.5.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide
Phonegap Cordova installation Windows
If you install Cygwin you can use unix commands on Windows CMD as you can see on this website https://lifehacker.com/362316/use-unix-commands-in-windows-built-in-command-prompt
Actually, it is possible to run UNIX commands on Windows. Have a look at all of the UNIX commands compiled for Windows in this GitHub repository: https://github.com/George-Ogden/UNIX

Cocos2D-x HelloCpp for Android unable to build apk from Windows due to permission denied on asset file

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

Categories

Resources