diff --git a/app/src/main/java/org/ethereum/android_app/MainActivity.java b/app/src/main/java/org/ethereum/android_app/MainActivity.java
index 3fcce65a..b9c8b523 100644
--- a/app/src/main/java/org/ethereum/android_app/MainActivity.java
+++ b/app/src/main/java/org/ethereum/android_app/MainActivity.java
@@ -101,8 +101,8 @@ public class MainActivity extends ActionBarActivity {
Log.v(TAG, "222");
long duration = ethereumManager.connect();
- ConsoleFragment consoleeFrag = (ConsoleFragment)getSupportFragmentManager().findFragmentById(R.id.console);
- consoleeFrag.updateDuration(duration);
+ //ConsoleFragment consoleeFrag = (ConsoleFragment)getSupportFragmentManager().findFragmentById(R.id.console);
+ //consoleeFrag.updateDuration(duration);
Log.v(TAG, "333");
while(true) {
diff --git a/ethereumj-core-android/build.gradle b/ethereumj-core-android/build.gradle
index 4b46b369..f72df6ec 100644
--- a/ethereumj-core-android/build.gradle
+++ b/ethereumj-core-android/build.gradle
@@ -43,10 +43,11 @@ tasks.withType(JavaCompile){
}
dependencies {
- apt 'com.google.dagger:dagger-compiler:2.0'
+ apt "com.google.dagger:dagger-compiler:2.0"
compile fileTree(dir: 'libs', include: ['*.jar'])
compile (project(':ethereumj-core')) {
- exclude group: 'commons-logging', module: 'commons-logging'
+ exclude group: "commons-codec", module: "commons-codec"
+ exclude group: "commons-logging", module: "commons-logging"
exclude group: "org.apache.commons", module: "commons-pool2"
exclude group: "org.slf4j", module: "slf4j-log4j12"
exclude group: "log4j", module: "apache-log4j-extras"
@@ -60,8 +61,10 @@ dependencies {
compile "com.j256.ormlite:ormlite-android:4.48"
compile "org.glassfish:javax.annotation:10.0-b28"
compile "org.iq80.leveldb:leveldb:0.7"
- compile 'org.slf4j:slf4j-android:1.7.12'
- compile 'javax.persistence:persistence-api:1.0.2'
+ compile "com.github.tony19:logback-android-core:1.1.1-3"
+ compile "com.github.tony19:logback-android-classic:1.1.1-3"
+ compile "org.slf4j:slf4j-api:1.7.12"
+ compile "javax.persistence:persistence-api:1.0.2"
- compile group: 'com.thetransactioncompany', name: 'jsonrpc2-server', version: '1.11'
+ compile group: "com.thetransactioncompany", name: "jsonrpc2-server", version: "1.11"
}
diff --git a/ethereumj-core-android/src/main/assets/logback.xml b/ethereumj-core-android/src/main/assets/logback.xml
new file mode 100644
index 00000000..ce77a6eb
--- /dev/null
+++ b/ethereumj-core-android/src/main/assets/logback.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+ ERROR
+ ACCEPT
+ DENY
+
+
+ %msg
+
+
+
+
+
+
+ TRACE
+ ACCEPT
+ DENY
+
+
+ ${LOG_DIR}/trace.log
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+ DEBUG
+ ACCEPT
+ DENY
+
+
+ ${LOG_DIR}/debug.log
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/datasource/LevelDbDataSource.java b/ethereumj-core-android/src/main/java/org/ethereum/android/datasource/LevelDbDataSource.java
index 1c9215e4..267f4ec8 100644
--- a/ethereumj-core-android/src/main/java/org/ethereum/android/datasource/LevelDbDataSource.java
+++ b/ethereumj-core-android/src/main/java/org/ethereum/android/datasource/LevelDbDataSource.java
@@ -3,6 +3,8 @@ package org.ethereum.android.datasource;
import org.ethereum.config.SystemProperties;
import org.ethereum.datasource.KeyValueDataSource;
+import org.fusesource.leveldbjni.JniDBFactory;
+import org.fusesource.leveldbjni.internal.JniDB;
import org.iq80.leveldb.CompressionType;
import org.iq80.leveldb.DB;
import org.iq80.leveldb.DBIterator;
@@ -53,12 +55,10 @@ public class LevelDbDataSource implements KeyValueDataSource {
Options options = new Options();
options.createIfMissing(true);
options.compressionType(CompressionType.NONE);
- org.iq80.leveldb.Logger logger1 = new org.iq80.leveldb.Logger() {
- public void log(String message) {
- logger.debug(message);
- }
- };
- options.logger(logger1);
+ options.blockSize(10 * 1024);
+ options.writeBufferSize(10 * 1024);
+ options.cacheSize(0);
+
try {
logger.debug("Opening database");
File dbLocation = new File(SystemProperties.CONFIG.databaseDir());
@@ -68,8 +68,24 @@ public class LevelDbDataSource implements KeyValueDataSource {
destroyDB(fileLocation);
}
- logger.debug("Initializing new or existing database: '{}'", fileLocation.getAbsolutePath());
- db = Iq80DBFactory.factory.open(fileLocation, options);
+ logger.debug("Initializing new or existing database: '{}'", name);
+
+ try {
+ db = JniDBFactory.factory.open(fileLocation, options);
+ } catch (Throwable e) {
+ System.out.println("No native version of LevelDB found");
+ }
+
+ String cpu = System.getProperty("sun.arch.data.model");
+ String os = System.getProperty("os.name");
+
+ if (db instanceof JniDB)
+ System.out.println("Native version of LevelDB loaded for: " + os + "." + cpu + "bit");
+ else{
+ System.out.println("Pure Java version of LevelDB loaded");
+ db = Iq80DBFactory.factory.open(fileLocation, options);
+ }
+
} catch (IOException ioe) {
logger.error(ioe.getMessage(), ioe);
@@ -143,4 +159,4 @@ public class LevelDbDataSource implements KeyValueDataSource {
logger.error("Failed to find the db file on the close: {} ", name);
}
}
-}
\ No newline at end of file
+}
diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/db/OrmLiteBlockStoreDatabase.java b/ethereumj-core-android/src/main/java/org/ethereum/android/db/OrmLiteBlockStoreDatabase.java
index 089ba4e8..1102fd8b 100644
--- a/ethereumj-core-android/src/main/java/org/ethereum/android/db/OrmLiteBlockStoreDatabase.java
+++ b/ethereumj-core-android/src/main/java/org/ethereum/android/db/OrmLiteBlockStoreDatabase.java
@@ -196,7 +196,7 @@ public class OrmLiteBlockStoreDatabase extends OrmLiteSqliteOpenHelper implement
try {
GenericRawResults rawResults = getBlockDao().queryRaw("select max(number) from block");
List results = rawResults.getResults();
- if (results.size() > 0 && results.get(0).length > 0) {
+ if (results.get(0)[0] != null) {
bestNumber = Long.valueOf(results.get(0)[0]);
}
} catch(java.sql.SQLException e) {