Git Product home page Git Product logo

Comments (7)

AlbertoMata avatar AlbertoMata commented on May 25, 2024 2

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.

capture _2017-09-02-14-27-41

capture _2017-09-02-14-15-13

from buildapks.

SDRausty avatar SDRausty commented on May 25, 2024 1

@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.

SDRausty avatar SDRausty commented on May 25, 2024
$ 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.

SDRausty avatar SDRausty commented on May 25, 2024

@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.

screenshot_20170902-212957

from buildapks.

AlbertoMata avatar AlbertoMata commented on May 25, 2024

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?

capture _2017-09-03-15-29-42

from buildapks.

SDRausty avatar SDRausty commented on May 25, 2024

@AlbertoMata Thank you for your help regarding this issue. This SDRausty/buildAPKsSamples@bf5793d closes it.

from buildapks.

AlbertoMata avatar AlbertoMata commented on May 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.