EdgeApp / airbitz-android-gui

35 stars 29 forks source link

How to compile this application? #10

Closed kostik-noir closed 7 years ago

kostik-noir commented 7 years ago

I use

OS

Kubuntu 16.04 (64-bit)

Java

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Android SDK Packages

# list Android SDK packages
$ANDROID_HOME/tools/bin/sdkmanager --list > ~/tmp/airbitz/android-sdk-packages.txt

see android-sdk-packages.txt

Preparatory steps

# make sure that everything is from scratch
rm -rf ~/.gradle
rm -rf ~/tmp/airbitz
mkdir -p ~/tmp/airbitz

cd ~/tmp/airbitz/

# clone Airbitz/airbitz-android-gui
git clone git@github.com:Airbitz/airbitz-android-gui.git
cd airbitz-android-gui/
cd Airbitz/

Compile branch master

# compile branch "master"
./gradlew installDevelopDebug > ~/tmp/airbitz/build-master-developdebug.log 2>&1

the compilation is failed due

com.android.jack.api.v01.CompilationException: Failed to compile
  at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:144)
  ...

also

grep -nr ERROR: ~/tmp/airbitz/build-master-developdebug.log
/home/kostik/tmp/airbitz/airbitz-android-gui/Airbitz/airbitz/src/main/java/com/airbitz/api/CoreWrapper.java:69.31: The type new Account.Callbacks(){} must implement the inherited abstract method Account.Callbacks.loginMessages(String)

see build-master-developdebug.log.txt

Compile branch develop

git checkout -b develop origin/develop
./gradlew installDevelopDebug > ~/tmp/airbitz/build-develop-developdebug.log 2>&1

the compilation is failed due

com.android.jack.api.v01.CompilationException: Failed to compile
  at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:144)
  ...

also

grep -nr ERROR: ~/tmp/airbitz/build-develop-developdebug.log 
241:ERROR: /home/kostik/tmp/airbitz/airbitz-android-gui/Airbitz/airbitz/src/main/java/com/airbitz/api/CoreWrapper.java:69.31: The type new Account.Callbacks(){} must implement the inherited abstract method Account.Callbacks.loginMessages(String)
379:ERROR: /home/kostik/tmp/airbitz/airbitz-android-gui/Airbitz/airbitz/src/main/java/com/airbitz/plugins/PluginFramework.java:131.92: bitrefill_api_key cannot be resolved or is not a field

see attached build-develop-developdebug.log.txt


The same occurs when I run ./gradlew installNettestDebug and ./gradlew installProdDebug

paullinator commented 7 years ago

Thanks for the heads up. I'll take a look at this today and let you know what I find.

paullinator commented 7 years ago

Hello @kostik-noir. I'm unable to reproduce the problem. Here's what I did

rm -rf ~/.gradle
rm -rf ~/.m2
git clone git@github.com:Airbitz/airbitz-android-gui.git
cd airbitz-android-gui/
cd Airbitz/
./gradlew installProdDebug

This successfully built and installed the APK onto a Genymotion device that I had running on my machine.

It's possible the installDevelopDebug that you did installed the Develop version of our Core SDK which has a changed API that isn't reflected in the GUI yet.

Give the commands up top a try with a clean airbitz-android-gui repo and let me know how it goes

kostik-noir commented 7 years ago

Ok. I'm able compile the app without errors using only ./gradlew installProdDebug. And this command install the app to the real device or to the emulator.

There is another issue. I can't signin or signup using this application. In both cases I see "An error has occured" after I entered password. I see the same message if I choose "Skip" => "Account has no password" => "Ok"

Research in data that I get as a result of adb logcat shows the same:

D/ABC     ( 3171): 2017-03-06 22:23:06 ABC_Log: ScryptSnrp::hash Nrp=16384 10 1 time=174330
D/ABC     ( 3171): 2017-03-06 22:23:07 ABC_Log: https://app.auth.airbitz.co/api/v1/account/create (401)
D/ABC     ( 3171): {"detail": "Invalid token header. No credentials provided."}
D/ABC     ( 3171): 2017-03-06 22:23:07 ABC_Log: Error 1 (Bad HTTP status code 401)
D/ABC     ( 3171):   at abcd/http/HttpRequest.cpp:73: codeOk
D/ABC     ( 3171):   at abcd/login/server/LoginServer.cpp:145: decode
D/ABC     ( 3171):   at abcd/login/server/LoginServer.cpp:233: loginServerCreate
D/ABC     ( 3171):   at abcd/login/Login.cpp:201: createNew
D/ABC     ( 3171):   at abcd/login/Login.cpp:56: createNew
D/ABC     ( 3171):   at src/LoginShim.cpp:97: cacheLoginNew

This occurs on real device and on Android emulator.

At the same time, Airbitz application from Play Market works okay.

Real device: ) Xiaomi Redme 3 ) Android version: 5.1.1 LMY47V *) MIUI version: MIUI-M 7.1 | Stable 7.1.3.0(LHPCNCK)

I've cleared the data and cache for this app before testing


Logs:


AVD Details

screenshot_20170307_005522

paullinator commented 7 years ago

@kostik-noir Looks like you need an API key and haven't put one in the config files. See the bottom of the README. https://github.com/Airbitz/airbitz-android-gui/blob/master/README.md

We failed to mention how to get the API keys but it's in the README on iOS. Go to https://developer.airbitz.co and login using an Airbitz wallet on mobile (barcode scan). Verify your email then you'll then see an API key in your account. Use that in the src/prod/res/values/keys.xml file.

Here is a sample keys.xml you can use. Just replace PUT_YOUR_API_KEY_HERE_FROM_DEVELOPER_AIRBITZ_CO with the key from your account.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="google_maps_api_key">XXXXXXXXXXXX</string>
    <string name="airbitz_business_directory_key">XXXXXXXXXXXX</string>
    <string name="hockey_key">XXXXXXXXXXXX</string>
    <string name="glidera_client_id">XXXXXXXXXXXX</string>

    <string name="airbitz_api_key">PUT_YOUR_API_KEY_HERE_FROM_DEVELOPER_AIRBITZ_CO</string>
    <string name="chain_api_key">XXXXXXXXXXXX</string>
    <string name="hiddenbitz_key">XXXXXXXXXXXX</string>

    <string name="clevercoin_api_key">XXXXXXXXXXXX</string>
    <string name="clevercoin_api_label">XXXXXXXXXXXX</string>
    <string name="clevercoin_api_secret">XXXXXXXXXXXX</string>

    <string name="fold_api_key">XXXXXXXXXXXX</string>
    <string name="bitrefill_api_key">XXXXXXXXXXXX</string>
    <string name="libertyx_api_key">XXXXXXXXXXXX</string>
</resources>
kostik-noir commented 7 years ago

Thank you. That works.

Can I use testnet when I compile app using ./gradlew installProdDebug? Or, how I can use testnet when I compile app using this way.

paullinator commented 7 years ago

Testnet would be ./gradlew installNettestDebug although honestly that mode is not thoroughly tested. Also it only connects to libbitcoin nodes for testnet while the mainnet build connects to both libbitcoin and electrum servers. Since the libbitcoin servers are unreliable, there's a chance you won't have a good testnet connection.

kostik-noir commented 7 years ago

Thanks for answers.