diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index a66d987ae..98ffe9d89 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,12 +1,16 @@ + android.versionCode="0" + android.versionName="0.0.0" + android:installLocation="preferExternal" + > + + - + + Ignore warning about SDK version + + + + + + + + + + @@ -135,6 +146,8 @@ + + @@ -147,6 +160,7 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Converting compiled files and external libraries into ${intermediate.dex.file}... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Running zip align on final apk... - - - - - - - - - - - - - - Installing ${out.debug.file} onto default emulator or device... - - - - - - - - - - - - - - Creating output directories if needed... - - - - - - - - - - - - - - - - - - - - Generating R.java / Manifest.java from the resources... - - - - - - hasCode = false. Skipping... - - - - - - - - - Compiling aidl files into Java classes... - - - - - - - hasCode = false. Skipping... - - - - - - - - - Compiling RenderScript files into Java classes and RenderScript bytecode... - - - - - - - hasCode = false. Skipping... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - hasCode = false. Skipping... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @${proguard.config} - -injars ${project.jars} - -outjars ${obfuscated.jar.file} - -libraryjars ${android.libraryjars} - -dump ${obfuscate.absolute.dir}/dump.txt - -printseeds ${obfuscate.absolute.dir}/seeds.txt - -printusage ${obfuscate.absolute.dir}/usage.txt - -printmapping ${obfuscate.absolute.dir}/mapping.txt - - - - - - - - - - - - - hasCode = false. Skipping... - - - - Packaging resources - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Debug Package: ${out.debug.file} - - - - - - - - - - - - No key.store and key.alias properties found in build.properties. - Please sign ${out.unsigned.file} manually - and run zipalign from the Android SDK tools. - - - - - - - - - - - - - - - - - - - - - - - - - - - ************************************************* - **** Android Manifest has debuggable=true **** - **** Doing DEBUG packaging with RELEASE keys **** - ************************************************* - - - - - - - - - - - - Signing final apk... - - - - - Release Package: ${out.release.file} - - - - - - - - - - - - - - Unable to run 'ant uninstall', manifest.package property is not defined. - - - - - - Uninstalling ${manifest.package} from the default emulator or device... - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - Instrumenting classes from ${out.absolute.dir}/classes... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Android Ant Build. Available targets: - help: Displays this help. - clean: Removes output files created by other targets. - compile: Compiles project's .java files into .class files. - debug: Builds the application and signs it with a debug key. - release: Builds the application. The generated apk file must be - signed before it is published. - install: Installs/reinstalls the debug package onto a running - emulator or device. - If the application was previously installed, the - signatures must match. - uninstall: Uninstalls the application from a running emulator or - device. - diff --git a/android/default.properties b/android/default.properties index 4513a1e4f..0b9250e02 100644 --- a/android/default.properties +++ b/android/default.properties @@ -8,4 +8,4 @@ # project structure. # Project target. -target=android-3 +target=android-8 diff --git a/android/scripts/setversion.sh b/android/scripts/setversion.sh index 4833d95ac..bf4e6b9d8 100755 --- a/android/scripts/setversion.sh +++ b/android/scripts/setversion.sh @@ -49,6 +49,8 @@ VERSIONINT=$(( \ )) echo "Android version: '$VERSIONSTRING' (${VERSIONINT})" +echo "my.version.name=${VERSIONSTRING}" > version.properties +echo "my.version.code=${VERSIONINT}" >> version.properties SUBST='s/android.versionCode="[0-9]"/android.versionCode="'${VERSIONINT}'"/' sed "$SUBST" < $MANIFEST > $TMP diff --git a/android/src/net/i2p/router/I2PAndroid.java b/android/src/net/i2p/router/I2PAndroid.java index 3c9c92bef..5210193a9 100644 --- a/android/src/net/i2p/router/I2PAndroid.java +++ b/android/src/net/i2p/router/I2PAndroid.java @@ -6,6 +6,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Resources; import android.content.res.Resources.NotFoundException; +import android.os.Build; import android.os.Bundle; import java.io.File; @@ -19,11 +20,12 @@ import net.i2p.data.DataHelper; import net.i2p.router.Router; import net.i2p.router.RouterLaunch; import net.i2p.util.OrderedProperties; +import net.i2p.util.NativeBigInteger; public class I2PAndroid extends Activity { static Context _context; - private String DIR = "/data/data/net.i2p.router/files"; + private String _myDir; /** Called when the activity is first created. */ @Override @@ -33,12 +35,13 @@ public class I2PAndroid extends Activity setContentView(R.layout.main); _context = this; // Activity extends Context - DIR = getFilesDir().getAbsolutePath(); + _myDir = getFilesDir().getAbsolutePath(); debugStuff(); initialize(); - // 300ms per run + // 300ms per run on emulator on eeepc // 5x slower than java on my server and 50x slower than native on my server - // NativeBigInteger.main(null); + // 33 ms native 29 ms java moto droid 2.2.2 + NativeBigInteger.main(null); } public void onRestart() @@ -104,9 +107,13 @@ public class I2PAndroid extends Activity System.err.println("user.dir" + ": " + System.getProperty("user.dir")); System.err.println("user.home" + ": " + System.getProperty("user.home")); System.err.println("user.name" + ": " + System.getProperty("user.name")); - System.err.println("getFilesDir()" + ": " + DIR); + System.err.println("getFilesDir()" + ": " + _myDir); System.err.println("Package" + ": " + getPackageName()); System.err.println("Version" + ": " + getOurVersion()); + System.err.println("MODEL" + ": " + Build.MODEL); + System.err.println("DISPLAY" + ": " + Build.DISPLAY); + System.err.println("VERSION" + ": " + Build.VERSION.RELEASE); + System.err.println("SDK" + ": " + Build.VERSION.SDK); } private String getOurVersion() { @@ -127,9 +134,9 @@ public class I2PAndroid extends Activity copyResourceToFile(R.raw.blocklist_txt, "blocklist.txt"); // Set up the locations so Router and WorkingDir can find them - System.setProperty("i2p.dir.base", DIR); - System.setProperty("i2p.dir.config", DIR); - System.setProperty("wrapper.logfile", DIR + "/wrapper.log"); + System.setProperty("i2p.dir.base", _myDir); + System.setProperty("i2p.dir.config", _myDir); + System.setProperty("wrapper.logfile", _myDir + "/wrapper.log"); } private void copyResourceToFile(int resID, String f) { @@ -178,7 +185,7 @@ public class I2PAndroid extends Activity } catch (IOException ioe) { System.err.println("Creating file " + f + " from resource"); } finally { - try { fin.close(); } catch (IOException ioe) {} + if (fin != null) try { fin.close(); } catch (IOException ioe) {} } DataHelper.storeProps(props, getFileStreamPath(f)); diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java index 730972bab..2859488c0 100644 --- a/core/java/src/net/i2p/util/NativeBigInteger.java +++ b/core/java/src/net/i2p/util/NativeBigInteger.java @@ -498,15 +498,10 @@ public class NativeBigInteger extends BigInteger { return true; } catch (UnsatisfiedLinkError ule) { if (_isAndroid) { - // temp debug + // Unfortunately, + // this is not interesting on Android, it says "file not found" + // on link errors too. warn("jbigi loadLibrary() fail", ule); - try { - System.load("/data/data/net.i2p.router/lib/libjbigi.so"); - return true; - } catch (Throwable t) { - warn("jbigi load() fail", t); - } - warn("Is the file there? " + (new File("/data/data/net.i2p.router/lib/libjbigi.so")).exists()); } return false; }