Comments (7)
I just modified the buildOne.sh script. Since I don't have a sdcard, I remove the /sdcard/Download/ prefix and left the directory builtAPKs in the local enviroment. Also, I removed the "src" argument of the "find" comand, so the '*.java' files can be found without problems. It looks like this:
#!/data/data/com.termux/files/usr/bin/sh -e
now=`date +%Y%m%d%s`
if [ ! -d "./bin" ]; then
mkdir ./bin
fi
if [ ! -d "./assets" ]; then
mkdir ./assets
fi
if [ ! -d "./res" ]; then
mkdir ./res
fi
if [ ! -d "builtAPKs" ]; then
mkdir builtAPKs
fi
echo "aapt begun"
aapt package -v -f \
-M ./AndroidManifest.xml \
-I $PREFIX/share/java/android.jar \
-J src \
-S res \
-m
echo "ecj begun"
ecj -d ./obj -classpath $HOME/../usr/share/java/android.jar \
-sourcepath ./app/src $(find -type f -name "*.java")
echo "dx begun"
dx --dex --verbose --output=./bin/classes.dex ./obj
echo "Make the apk"
aapt package -v -f \
-M ./AndroidManifest.xml \
-S ./res \
-A ./assets \
-F bin/step2.apk
echo "Add the classes.dex to the apk"
cd bin
aapt add -f step2.apk classes.dex
echo "Sign step2.apk"
apksigner ../step2-debug.key step2.apk ../step2.apk
cd ..
echo "And make it accessible to the outside world"
chmod 644 step2.apk
echo "Our Step2 app is ready to go"
cp step2.apk builtAPKs/step2$now.apk
echo "Copied to /sdcard/Download/builtAPKs/step2$now.apk"
echo "You can install step2$now.apk from /sdcard/Download/builtAPKs/"
sleep 1
Before being executed, the buildOne.sh script should be placed in the same directory as the AndroidManifest.xml. Run it; you'll end up with a mess of files and directories, but the apk file can be found in the ./builtAPKs directory (the build.gradle file is just ignored by the script.). Copy this apk file to your /storage/emulated/0/Download/ directory and tap on it.
The application works, but I don't know why request those permissions if they are not declared in the AndroidManifest.xml (or in any place). Thanks for the answers.
from buildapks.
@AlbertoMata it appears that setting it to SDK level 1 (one) is sufficient. aapt package -f \ --min-sdk-version 1 \
https://github.com/sdrausty/buildAPKs/blob/master/scripts/build/buildOne.sh
Confirmations requested
from buildapks.
$ gcl https://github.com/czak/minimal-android-project/
Cloning into 'minimal-android-project'...
remote: Counting objects: 72, done.
remote: Total 72 (delta 0), reused 0 (delta 0), pack-reused 72
Unpacking objects: 100% (72/72), done.
$ cd minimal-android-project/
$ l
total 28
drwx------ 4 u0_a93 u0_a93 4096 Sep 2 12:04 .
drwx------ 11 u0_a93 u0_a93 4096 Sep 2 12:04 ..
drwx------ 7 u0_a93 u0_a93 4096 Sep 2 12:04 .git
-rw------- 1 u0_a93 u0_a93 14 Sep 2 12:04 .gitignore
-rw------- 1 u0_a93 u0_a93 1773 Sep 2 12:04 README.md
-rw------- 1 u0_a93 u0_a93 251 Sep 2 12:04 build.gradle
drwx------ 3 u0_a93 u0_a93 4096 Sep 2 12:04 src
$ buildAll.sh
aapt begun
.
.
.
at com.android.dx.command.Main.main(Main.java:94)
1 error; aborting
How did you get https://github.com/czak/minimal-android-project/ to build on device in Termux @AlbertoMata ? It has a build.gradle file https://github.com/sdrausty/buildAPKs/issues/3 , so I am not surprised it's not building with this system.
from buildapks.
@AlbertoMata You are very welcome. It is really pleasing to see you building APKs in Termux on device. Thanks to your input I managed to get your test program to build on device in Termux! Also after checking ./scripts/build/buildHelloWorlds.sh
and noting that two of three of these APKs also ask for permissions, which as you well note are not necessary for a hello World app. You have brought up a very good point. Thank you for bringing this to our attention 😀 Test app doesn't ask for spurious permissions.
from buildapks.
I found the answer in StackOverflow.
Those permissions (READ_PHONE_STATE and WRITE_EXTERNAL_STORAGE) are implicitly granted for applications that use a version of the API <= 3 (android 1.6). Also, if the attribute minSdkVersion is not specified is set by default to "1". Everything is oficially documented here:
https://developer.android.com/guide/topics/manifest/uses-sdk-element.html
https://developer.android.com/reference/android/Manifest.permission.html#WRITE_EXTERNAL_STORAGE
https://developer.android.com/reference/android/Manifest.permission.html#READ_PHONE_STATE
Adding the following line to the android manifest solves the problem (of course, you can set the attributes to any required value):
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="4" />
I'm still curious, how was the aapt tool ported to Termux?
from buildapks.
@AlbertoMata Thank you for your help regarding this issue. This SDRausty/buildAPKsSamples@bf5793d closes it.
from buildapks.
I didn't know that argument even exists, although makes a lot of sense. Unfortunately, I don't have the enviroment configured in my cellphone this days, but I'm glad to see this project running up.
from buildapks.
Related Issues (20)
- Add an external jar dependency? HOT 4
- Building APK HOT 2
- Problem with buildMyFirstAPK.sh HOT 14
- buildOne.bash --> Unbound "DAY" and "RDR"? HOT 7
- Java is missing HOT 6
- Request to add support for gradle project HOT 8
- some more apps and questions HOT 14
- BuildAPKs tots.bash EXIT: Signal 1 received by build.entertainment.bash! HOT 3
- error with buildMyFirstAPK.sh HOT 4
- Building 1 new APK HOT 8
- some error while building package HOT 2
- Lets bring The power of Pascal and Pandroid bundle to yours wonderful tool HOT 9
- Getting error when i am running zsh script (~/buildAPKs/scripts/bash/build/build.entertainment.bash) HOT 6
- seems broken HOT 5
- lets try to build Pandroid projects HOT 18
- Artifacts only for API 23.x are supported. HOT 15
- Can this app be built? HOT 3
- appcompat not working HOT 3
- Your moon.apk was copied to /sdcard/Download/moon.apk It is ready to be installed. Install moon.apk from /sdcard/Download/ using your file manager from Android HOT 3
- errors with ecj HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buildapks.