├── app ├── .gitignore ├── src │ └── main │ │ ├── assets │ │ ├── libc++.so │ │ ├── arm64-v8a │ │ │ ├── libuv │ │ │ └── xmrig │ │ ├── armeabi-v7a │ │ │ ├── libuv │ │ │ └── xmrig │ │ └── config.json │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── de │ │ └── ludetis │ │ └── monerominer │ │ ├── Tools.java │ │ ├── MainActivity.java │ │ └── MiningService.java ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── README.md ├── gradlew.bat ├── gradlew └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /app/src/main/assets/libc++.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/assets/libc++.so -------------------------------------------------------------------------------- /app/src/main/assets/arm64-v8a/libuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/assets/arm64-v8a/libuv -------------------------------------------------------------------------------- /app/src/main/assets/arm64-v8a/xmrig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/assets/arm64-v8a/xmrig -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/assets/armeabi-v7a/libuv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/assets/armeabi-v7a/libuv -------------------------------------------------------------------------------- /app/src/main/assets/armeabi-v7a/xmrig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/assets/armeabi-v7a/xmrig -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upost/MoneroMiner/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | gradle/ 4 | /local.properties 5 | .idea/ 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/assets/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "algo": "cryptonight", 3 | "av": 0, 4 | "background": false, 5 | "colors": false, 6 | "cpu-affinity": null, 7 | "cpu-priority": 2, 8 | "donate-level": 0, 9 | "log-file": null, 10 | "max-cpu-usage": $maxcpu$, 11 | "print-time": 60, 12 | "retries": 5000, 13 | "retry-pause": 5, 14 | "safe": false, 15 | "syslog": false, 16 | "threads": $threads$, 17 | "pools": [ 18 | { 19 | "url": "$url$", 20 | "user": "$username$", 21 | "pass": "x", 22 | "keepalive": true, 23 | "nicehash": false 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MoneroMiner 3 | Mining Pool Address 4 | Username 5 | Cmdline 6 | Start 7 | Help 8 | Cmd 9 | Stop 10 | Threads 11 | Max CPU usage 12 | percent 13 | H/s 14 | accepted 15 | Cores 16 | add worker id 17 | 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | 6 | 7 | compileOptions { 8 | sourceCompatibility JavaVersion.VERSION_1_8 9 | targetCompatibility JavaVersion.VERSION_1_8 10 | } 11 | 12 | 13 | defaultConfig { 14 | applicationId "de.ludetis.monerominer" 15 | minSdkVersion 19 16 | targetSdkVersion 29 17 | versionCode 1 18 | versionName "1.0" 19 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 20 | 21 | } 22 | buildTypes { 23 | release { 24 | minifyEnabled false 25 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 26 | } 27 | } 28 | 29 | } 30 | 31 | dependencies { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Monero Miner for Android 2 | 3 | Proof of concept using the xmrig miner inside an Android APK. 4 | 5 | # Sorry, this was only meant as a proof of concept. The project is not maintained anymore. Anyway it's not advisable to use it on a single phone, as it will be waaayy to slow to generate any revenue. 6 | 7 | Based on the binaries from https://github.com/NanoBytesInc/miners 8 | Which is based on the code from https://github.com/xmrig/xmrig 9 | 10 | # Usage 11 | 12 | This will currently only work on devices with ARM64 architecture. 13 | 14 | Install and run the app, enter your pool and wallet data, then press the start button 15 | to start mining or stop to stop mining. 16 | The prefilled wallet is mine, so if you try the app, just keep it and I earn, 17 | ehm... next to nothing ;-) 18 | The help button will show xmrig's help output for convenience. 19 | 20 | As this is considered a proof of concept, only pool address, username, threads and max cup usage can be 21 | edited in the UI currently (there is currently no sanity check to your inputs). You can change the rest of the config in assets/config.json. 22 | The configuration is set to low values and regular display of hashrate is set to 1m. 23 | 24 | # Notes 25 | 26 | The xmrig binary is copied to the app's internal directory along with its dependent libraries. 27 | (This is done because it can only be executed there.) 28 | Then, the binary is started using the ProcessBuilder class, and the output is captured 29 | into the app's scrolling pane once each secons. 30 | 31 | Currently only arm64 binaries are included, and the app will refuse to work on 32 | other architectures like x86 or 32 bit devices. 33 | 34 | # License 35 | 36 | xmrig is licensed as GPLv3, thus this derivative work also is. 37 | You need to consider this if you plan to build a "real" Android app. You'd propably need 38 | to make it GPLv3 also, unless you can somehow make use of the GPL clause which allows 39 | to bundle a GPLv3 binary with another propietary licensed binary. 40 | 41 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/java/de/ludetis/monerominer/Tools.java: -------------------------------------------------------------------------------- 1 | /* 2 | * File Tools for Monero Miner 3 | * (c) 2018 Uwe Post 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | * / 18 | */ 19 | 20 | package de.ludetis.monerominer; 21 | 22 | import android.content.Context; 23 | 24 | import java.io.BufferedReader; 25 | import java.io.File; 26 | import java.io.FileOutputStream; 27 | import java.io.FileReader; 28 | import java.io.IOException; 29 | import java.io.InputStream; 30 | import java.io.InputStreamReader; 31 | import java.io.PrintWriter; 32 | import java.util.HashMap; 33 | import java.util.Map; 34 | 35 | /** 36 | * Created by uwe on 19.01.18. 37 | */ 38 | 39 | public class Tools { 40 | 41 | 42 | /** 43 | * load the config.json template file 44 | * @param context 45 | * @return 46 | * @throws IOException 47 | */ 48 | public static String loadConfigTemplate(Context context) { 49 | try { 50 | StringBuilder buf = new StringBuilder(); 51 | InputStream json = context.getAssets().open("config.json"); 52 | BufferedReader in = new BufferedReader(new InputStreamReader(json, "UTF-8")); 53 | String str; 54 | 55 | while ((str = in.readLine()) != null) { 56 | buf.append(str); 57 | } 58 | 59 | in.close(); 60 | return buf.toString(); 61 | } catch (IOException e) { 62 | throw new RuntimeException(e); 63 | } 64 | } 65 | 66 | 67 | /** 68 | * copy a file from the assets to a local path 69 | * @param context 70 | * @param assetFilePath 71 | * @param localFilePath 72 | */ 73 | public static void copyFile(Context context, String assetFilePath, String localFilePath) { 74 | try { 75 | InputStream in = context.getAssets().open(assetFilePath); 76 | FileOutputStream out = new FileOutputStream(localFilePath); 77 | int read; 78 | byte[] buffer = new byte[4096]; 79 | while ((read = in.read(buffer)) > 0) { 80 | out.write(buffer, 0, read); 81 | } 82 | out.close(); 83 | in.close(); 84 | 85 | File bin = new File(localFilePath); 86 | bin.setExecutable(true); 87 | 88 | } catch (IOException e) { 89 | throw new RuntimeException(e); 90 | } 91 | } 92 | 93 | /** 94 | * write a config.json using the template and the given values 95 | * @param configTemplate 96 | * @param poolUrl 97 | * @param username 98 | * @param privatePath 99 | * @throws IOException 100 | */ 101 | public static void writeConfig(String configTemplate, String poolUrl, String username, int threads, int maxCpu, String privatePath) { 102 | String config = configTemplate.replace("$url$",poolUrl) 103 | .replace("$username$",username) 104 | .replace("$threads$", Integer.toString(threads)) 105 | .replace("$maxcpu$", Integer.toString(maxCpu)); 106 | PrintWriter writer = null; 107 | try { 108 | writer = new PrintWriter(new FileOutputStream(privatePath+"/config.json")); 109 | writer.write(config); 110 | } catch (IOException e) { 111 | throw new RuntimeException(e); 112 | } finally { 113 | if (writer != null) writer.close(); 114 | } 115 | } 116 | 117 | public static Map getCPUInfo () { 118 | 119 | Map output = new HashMap<>(); 120 | 121 | try { 122 | BufferedReader br = null; 123 | br = new BufferedReader(new FileReader("/proc/cpuinfo")); 124 | 125 | String str; 126 | 127 | while ((str = br.readLine ()) != null) { 128 | 129 | String[] data = str.split (":"); 130 | 131 | if (data.length > 1) { 132 | 133 | String key = data[0].trim ().replace (" ", "_"); 134 | if (key.equals ("model_name")) key = "cpu_model"; 135 | 136 | String value = data[1].trim (); 137 | 138 | if (key.equals ("cpu_model")) 139 | value = value.replaceAll ("\\s+", " "); 140 | 141 | output.put (key, value); 142 | 143 | } 144 | 145 | } 146 | 147 | br.close (); 148 | } catch (Exception e) { 149 | throw new RuntimeException(e); 150 | } 151 | 152 | return output; 153 | 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 18 | 19 | 24 | 25 | 26 | 27 | 31 | 32 | 37 | 38 | 42 | 43 | 48 | 49 | 55 | 56 | 57 | 62 | 63 | 66 | 70 | 75 | 76 | 81 | 86 | 91 | 95 | 96 | 97 | 98 | 101 | 108 | 113 | 120 | 124 | 125 | 126 | 130 | 131 | 137 | 138 | 139 | 140 | 141 | 145 | 146 | 147 | 148 | 149 |