首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Android中导入GraphStream库

在Android中导入GraphStream库
EN

Stack Overflow用户
提问于 2018-06-05 17:56:51
回答 1查看 649关注 0票数 0

我已经导入了gs-ui-android和gs-核心-2.0-alpha模块,它们也反映在settings.gradle中。还在gradle应用程序模块中包括了这些

代码语言:javascript
复制
implementation files(':gs-ui-android')
implementation files(':gs-core-2.0-alpha')

还包括进口报表

代码语言:javascript
复制
 import org.graphstream.graph.*;
    import org.graphstream.graph.implementations.*;

我在这段代码中仍然有一个错误

错误:包org.graphstream.graph不存在错误:包org.graphstream.graph.implementations不存在错误:找不到符号类SingleGraph错误:不兼容类型:字符串不能转换为节点错误:找不到符号类查看器

代码示例:

代码语言:javascript
复制
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模块):

代码语言:javascript
复制
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()
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-26 09:27:26

您可以使用jitpack导入github项目。

代码语言:javascript
复制
allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

然后,您可以将链接放到所需的版本中。

代码语言:javascript
复制
dependencies {
    api 'com.github.graphstream:gs-ui-android:2.0-alpha'
    api 'com.github.graphstream:gs-core:2.0-alpha'
}

在这里你可以看到一个例子

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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50706239

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档