Hive2Hive / Android

Android application for Hive2Hive
MIT License
17 stars 7 forks source link

Gradle Exception #1

Open qing3gan opened 9 years ago

qing3gan commented 9 years ago

There are some exception occurred when i used the "gradlew clean" command like "could not find org.hive2hive:org.hive2hive.core:1.2.2.So,how can i import your project of hive2hive of android into my Android Studio?

nicoruti commented 9 years ago

Hive2Hive is not available on maven central. Thus, a custom repo is required. Can you replace the following code in org.hive2hive.mobile/app/build.gradle

repositories {
    maven { url 'http://tomp2p.net/dev/mvn/' }
    maven { url '// maven { url \'http://repo.hive2hive.org\' }' }
    mavenLocal()
}

with

repositories {
    maven { url 'http://tomp2p.net/dev/mvn/' }
    maven { url 'http://repo.hive2hive.org' }
    mavenLocal()
}

and test again?

qing3gan commented 9 years ago

it seems not useful, and also failed to resolve:org.hive2hive:org.hive2hive.core:1.2.2, but i use another way that is import org.hive2hive.core.1.2.2.jar directly.By the way,i have new question about GoogleServices, my phone doesn't have google play, and cannot install it.Can i use other way to get the app run?(The app is reported the error about "GoogleServiceUtils and GooglePlay" when i want to run it.)

qing3gan commented 9 years ago

uh...,Android devices can not create a network?(The app only have the connect option...)

nicoruti commented 9 years ago

By the way,i have new question about GoogleServices, my phone doesn't have google play, and cannot install it.Can i use other way to get the app run?

I tried to implement it that way that you don't need Google Services if you don't choose the GCM mode. However, I must have changed something after testing it. Probably there's a problem with the GCMIntentService (the listener on the Android system for Google Cloud Messages). You might have success when removing the intent from the AndroidManifest.xml.

uh...,Android devices can not create a network?(The app only have the connect option...)

Unfortunately not. You need to have a reachable public peer somewhere. There's a step-by-step guide here. But it's a good point. I'll open an extra issue for this feature.

qing3gan commented 9 years ago

Thanks a lot by your careful answer!!! I will keep studying on.

qing3gan commented 9 years ago

Hi , i'm come back. I have a problem with user login. Since i have connected to the created network by running the deployment/StableH2HPeer.java , but the app is blocking at process of 3/4(logging in) when i want to login, and a period of time pass, it reported error which is "credentials are incorrect". The report confused me that i'm just the first time regist and login, and the logcat get this exception: 15:29:42.920 6507-8047/org.hive2hive.mobile E/org.hive2hive.mobile.login.UserLoginTask﹕ Cannot login user 1 org.hive2hive.processframework.exceptions.ProcessExecutionException: An exception has been catched during execution. See cause for more information. at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:83) ~[na:0.0] at org.hive2hive.processframework.composites.SyncProcess.doExecute(SyncProcess.java:55) ~[na:0.0] at org.hive2hive.processframework.composites.SyncProcess.doExecute(SyncProcess.java:1) ~[na:0.0] at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:70) ~[na:0.0] at org.hive2hive.mobile.login.UserLoginTask.doInBackground(UserLoginTask.java:80) ~[na:0.0] at org.hive2hive.mobile.login.UserLoginTask.doInBackground(UserLoginTask.java:23) ~[na:0.0] at android.os.AsyncTask$2.call(AsyncTask.java:288) ~[na:0.0] at java.util.concurrent.FutureTask.run(FutureTask.java:237) ~[na:0.0] at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) ~[na:0.0] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) ~[na:0.0] at java.lang.Thread.run(Thread.java:841) ~[na:0.0] Caused by: java.lang.NullPointerException: null at org.hive2hive.core.network.data.vdht.VersionManager.put(VersionManager.java:164) ~[na:0.0] at org.hive2hive.core.network.data.vdht.LocationsManager.put(LocationsManager.java:37) ~[na:0.0] at org.hive2hive.core.processes.login.PutLocationsStep.doExecute(PutLocationsStep.java:30) ~[na:0.0] at org.hive2hive.core.processes.login.PutLocationsStep.doExecute(PutLocationsStep.java:1) ~[na:0.0] at org.hive2hive.processframework.ProcessComponent.execute(ProcessComponent.java:70) ~[na:0.0] ... 11 common frames omitted And i use deployment/MultiStableH2HPeers.java as "init network", but the device cannot connect to the network.

nicoruti commented 9 years ago

I've observed this issue sometimes as well. It has to do with the replication: Hive2Hive has a replication factor of 5 peers, which means that data is stored at five different peers. The 'put' procedure is successful if the majority (more than half of the peers) confirm that the data is stored. If less peers are available, the 'put' procedure succeeds anyway, but the data is sometimes not stored.

I added a note that it's recommended to start at least 5 initial peers. Just use the MultiStableH2HPeers.java class instead of StableH2HPeer.java and configure the deployment.conf file accordingly.

qing3gan commented 9 years ago

I use the MultiStableH2HPeers.java class and configure the deloyment.conf below:

NumPeers = 5

StartPort=4622

ExternalAddress = 192.168.1.106

AcceptData = true

Relay {
enabled = true
    GCM {           
        api-key = "your-api-key"
        buffer-age-limit = 20s
    }
}

With Open TCP mode(pc and phone connected the same wifi),but the phone could not connect pc.

qing3gan commented 8 years ago

I have a stupid request, I can ask you to get some information on tomp2p (PDF Lecture), because I can not access the resources of the University of Zurich, and the tomp2p's official website information or not to make me fully understand the working principle of tomp2p. I am also a college student, want to study the subject of P2P, I hope you can help me, if not, that is no matter. Forgive me for contacting you in this way.