Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions for building the app & for reproducible builds of apk in google-play #3

Open
emanuelb opened this issue Jun 15, 2021 · 0 comments

Comments

@emanuelb
Copy link

emanuelb commented Jun 15, 2021

Using ContainerFile:
compile: podman build --pull --rm -t xwallet_build_apk -f ContainerFile

FROM frolvlad/alpine-glibc

RUN set -ex; \
    apk update; \
    apk add --no-cache \
        openjdk8 \
        bash \
        git; \
    adduser -D appuser;

USER appuser

ENV ANDROID_SDK_ROOT="/home/appuser/app/sdk" \
    ANDROID_HOME="/home/appuser/app/sdk"
    
RUN set -ex; \
    mkdir -p "/home/appuser/app/sdk/licenses" "/home/appuser/app/xwallet/"; \
    printf "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "/home/appuser/app/sdk/licenses/android-sdk-license"; \
    cd /home/appuser/app/xwallet/; \
    git clone https://github.com/ehanoc/xwallet/; \
    cd xwallet;
     
WORKDIR /home/appuser/app/xwallet/xwallet/

then run: run: podman run --rm --name xwallet_built_apk -ti xwallet_build_apk

inside container:

Running ./gradle assembleRelease Result:

* What went wrong:
A problem occurred configuring root project 'xwallet'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.3-SNAPSHOT.
     Searched in the following locations:
         https://jcenter.bintray.com/com/getkeepsafe/dexcount/dexcount-gradle-plugin/0.6.3-SNAPSHOT/maven-metadata.xml
         https://jcenter.bintray.com/com/getkeepsafe/dexcount/dexcount-gradle-plugin/0.6.3-SNAPSHOT/dexcount-gradle-plugin-0.6.3-SNAPSHOT.pom
         https://jcenter.bintray.com/com/getkeepsafe/dexcount/dexcount-gradle-plugin/0.6.3-SNAPSHOT/dexcount-gradle-plugin-0.6.3-SNAPSHOT.jar
         https://oss.sonatype.org/content/repositories/snapshots/com/getkeepsafe/dexcount/dexcount-gradle-plugin/0.6.3-SNAPSHOT/maven-metadata.xml
         https://oss.sonatype.org/content/repositories/snapshots/com/getkeepsafe/dexcount/dexcount-gradle-plugin/0.6.3-SNAPSHOT/dexcount-gradle-plugin-0.6.3-SNAPSHOT.pom
         https://oss.sonatype.org/content/repositories/snapshots/com/getkeepsafe/dexcount/dexcount-gradle-plugin/0.6.3-SNAPSHOT/dexcount-gradle-plugin-0.6.3-SNAPSHOT.jar
     Required by:
         project :

Fix by running: sed -i 's/0.6.3-SNAPSHOT/0.6.3/' build.gradle
as no version 0.6.3-SNAPSHOT exists: https://mvnrepository.com/artifact/com.getkeepsafe.dexcount/dexcount-gradle-plugin

Then errors:

:app:compileReleaseJavaWithJavac
:app:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/home/appuser/app/xwallet/xwallet/app/src/main/java/com/bytetobyte/xwallet/ui/activity/MainActivity.java:70: error: cannot find symbol
        new TwitterAuthApi(getString(R.string.twitter_api_key), getString(R.string.twitter_api_secret), this).execute();
                                             ^
  symbol:   variable twitter_api_key
  location: class string
/home/appuser/app/xwallet/xwallet/app/src/main/java/com/bytetobyte/xwallet/ui/activity/MainActivity.java:70: error: cannot find symbol
        new TwitterAuthApi(getString(R.string.twitter_api_key), getString(R.string.twitter_api_secret), this).execute();
                                                                                  ^
  symbol:   variable twitter_api_secret
  location: class string
/home/appuser/app/xwallet/xwallet/app/src/main/java/com/bytetobyte/xwallet/util/EncryptUtils.java:20: error: cannot find symbol
        String key = context.getString(R.string.skey);
                                               ^
  symbol:   variable skey
  location: class string
/home/appuser/app/xwallet/xwallet/app/src/main/java/com/bytetobyte/xwallet/util/EncryptUtils.java:21: error: cannot find symbol
        String salt = context.getString(R.string.ksalt);
                                                ^
  symbol:   variable ksalt
  location: class string
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors
:app:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

fix by adding below to file ./app/src/main/res/values/strings.xml under wallet_str at:
https://github.com/ehanoc/xwallet/blob/6a49d1a82f5bbb55103a33b85b393700d78fa817/app/src/main/res/values/strings.xml#L5

values taken from APK downloaded from google-play version: 0.3.1-beta.

    <string name="twitter_api_key">ReDJqIMcBqYqGrAGbWvOfXgAi</string>
    <string name="twitter_api_secret">U6JUq7TfkIa1JgKZ73EnTeSIbCmxRofg94QiaylGcZXCyaAL2l</string>
    <string name="skey">as@_a%sdzzWas=</string>
    <string name="ksalt">uTwbhys%ahakw</string>
    <string name="fkey">30251af42f431aaef6163744c97d7a8b9ba59fe0</string>
    <string name="com_crashlytics_android_build_id">0b697bad-85c1-40e6-9c22-9a1b85b0fe9c</string>

Then app compiled, APK in: /home/appuser/app/xwallet/xwallet/app/build/outputs/apk/app-release-unsigned.apk
But there difference between the results & the apk downloaded from google-play, see related issue to publish code for 0.3.1-beta version, see issue #2 (as the compiled version is 0.3.0-beta)

diffs are:

Files ./FromGoogle/AndroidManifest.xml and ./LocalBuild/AndroidManifest.xml differ
Only in ./FromGoogle/assets: crashlytics-build.properties
Files ./FromGoogle/classes2.dex and ./LocalBuild/classes2.dex differ
Files ./FromGoogle/classes.dex and ./LocalBuild/classes.dex differ
Only in ./FromGoogle: fabric
Only in ./FromGoogle/META-INF: CERT.RSA
Only in ./FromGoogle/META-INF: CERT.SF
Files ./FromGoogle/META-INF/MANIFEST.MF and ./LocalBuild/META-INF/MANIFEST.MF differ
Files ./FromGoogle/res/layout/fragment_wallet_backup.xml and ./LocalBuild/res/layout/fragment_wallet_backup.xml differ
Files ./FromGoogle/resources.arsc and ./LocalBuild/resources.arsc differ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant