0

I've imported the gs-ui-android and gs-core-2.0-alpha modules and they are reflected in the settings.gradle as well. Also included these in gradle app module

implementation files(':gs-ui-android')
implementation files(':gs-core-2.0-alpha')

Also included import statements

 import org.graphstream.graph.*;
    import org.graphstream.graph.implementations.*;

I still get an error in this code

error: package org.graphstream.graph does not exist error: package org.graphstream.graph.implementations does not exist error: cannot find symbol class SingleGraph error: incompatible types: String cannot be converted to Node error: cannot find symbol class Viewer

Code Sample:

Graph graph1 = new SingleGraph("I can see dead pixels");
    graph1.addNode("A" );
    graph1.addNode("B" );
    graph1.addNode("C" );
    graph1.addEdge("AB", "A", "B");
    graph1.addEdge("BC", "B", "C");
    graph1.addEdge("CA", "C", "A");
    Viewer viewer = graph1.display();

Build.gradle(app module):

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.0.1'
    implementation 'io.particle:devicesetup:0.4.9'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.github.john990:WaveView:v0.9'
    implementation 'org.giwi:android-network-graph:0.0.1'
    // implementation 'guru.nidi:graphviz-java:0.2.3'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:1.0.3'
    api 'com.github.graphstream:gs-ui-android:2.0-alpha'
    api 'com.github.graphstream:gs-core:2.0-alpha'
//    implementation files(':gs-ui-android')
//    implementation files(':gs-core-2.0-alpha')

}
repositories {
    mavenCentral()
}
Simra
  • 3
  • 1
  • 5

1 Answers1

2

You can use jitpack to import github projects

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Then you can put the links to the desired version

dependencies {
    api 'com.github.graphstream:gs-ui-android:2.0-alpha'
    api 'com.github.graphstream:gs-core:2.0-alpha'
}

Here you can see an example

https://github.com/graphstream/gs-ui-android-test

H.Brahimi
  • 254
  • 1
  • 7
  • I have included these...Still does not resolve the problem – Simra Jun 29 '18 at 04:26
  • Confirm that you are using the same version of gs-core and gs-android. Can you run the example? – H.Brahimi Jun 29 '18 at 20:33
  • Yes I'm using the same version of both still getting the error – Simra Jul 02 '18 at 14:11
  • Can you edit your post to show your build.gradle modified ? – H.Brahimi Jul 03 '18 at 14:59
  • I cannot reproduce the issue. Make sure that the min SDK version of your project is 26 and your Source/Target Compatibility are 1.8. Clean/Rebuild and if that still don't work, try to run the example project I have given you. – H.Brahimi Jul 05 '18 at 15:33
  • thanks, changing the MIN SDK version solved the above issue but the code still produces an error: `Caused by: java.lang.RuntimeException: Cannot launch viewer.` Any help would be appreciated – Simra Jul 06 '18 at 18:30
  • You can't use display method in Android, you need to construct your view with fragments. Look the [examples](https://github.com/graphstream/gs-ui-android-test/tree/master/app/src/main/java/ui/graphstream/org). – H.Brahimi Jul 08 '18 at 02:06