Importing GraphStream library in Android Studio - java

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()
}

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

Related

Cannot query the value of task 'allDepInsight' property 'showingAllVariants' because it has no value available

I have upgraded gradle to latest gradle 7 from gradle 4 .
while executing allDepInsight --configuration compileClasspath --dependency log4j-core I am getting below error
Could not determine the dependencies of task ':project-module-test:allDepInsight'.
Cannot query the value of task 'allDepInsight' property 'showingAllVariants' because it has no value available.
Please find below build.gradle file
apply plugin: 'groovy'
sourceSets {
attributesTest {
java { srcDir 'src/main/java' }
groovy { srcDir 'src/main/groovy' }
resources { srcDirs = ['src/main/resources'] }
compileClasspath = sourceSets.main.output + configurations.runtimeClasspath
runtimeClasspath = compileClasspath + output
}
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.13.1'
implementation 'org.jboss.resteasy:jaxrs-api:3.0.12.Final'
implementation 'org.jboss.resteasy:resteasy-client:3.11.3.Final'
implementation 'org.freemarker:freemarker:2.3.30'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'org.apache.httpcomponents:httpmime:4.5.1'
implementation 'org.apache.commons:commons-lang3:3.1'
implementation 'org.apache.commons:com.springsource.org.apache.commons.lang:2.6.0'
implementation "org.springframework:spring-beans:$rev_spring"
implementation "org.springframework:spring-context:$rev_spring"
implementation "org.springframework:spring-core:$rev_spring"
implementation "org.springframework:spring-web:$rev_spring"
implementation "org.springframework:spring-webmvc:$rev_spring"
implementation "org.springframework:spring-context-support:$rev_spring"
implementation "org.springframework:spring-aop:$rev_spring"
implementation "org.springframework:spring-expression:$rev_spring"
implementation "org.springframework:spring-jdbc:$rev_spring"
implementation "org.springframework:spring-orm:$rev_spring"
implementation "org.springframework:spring-tx:$rev_spring"
implementation "org.springframework.security:spring-security-web:$rev_spring_security"
implementation "org.springframework.security:spring-security-config:$rev_spring_security"
implementation "org.springframework:spring-test:$rev_spring"
implementation 'org.json:json:20090211'
implementation "org.jasypt:jasypt:$rev_jasypt"
implementation "org.codehaus.groovy:groovy-all:$rev_groovy"
implementation "org.codehaus.gpars:gpars:$rev_gpars"
implementation "org.spockframework:spock-core:$rev_spock"
implementation "org.spockframework:spock-spring:$rev_spock"
implementation libraries.spring
implementation libraries.rest
implementation libraries.groovy
testImplementation libraries.test
testImplementation libraries.encryption
}
task attributesTest(type: Test) {
testClassesDirs = sourceSets.attributesTest.output.classesDirs
classpath = sourceSets.attributesTest.runtimeClasspath
systemProperties System.properties
testLogging.showStandardStreams = true
}

Android ClassCircularityError

I get ClassCircularityError when my app launch. It seems to appear after I added
implementation 'com.google.android.play:core:1.6.5'
to my app level gradle file. Here is my stacktrace:
Fatal Exception: java.lang.ClassCircularityError: Class byte extends itself (declaration of 'byte' appears in base.apk!classes3.dex)
at dalvik.system.DexFile.defineClassNative(DexFile.java)
at dalvik.system.DexFile.defineClass(DexFile.java:282)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:275)
at dalvik.system.DexPathList$Element.findClass(DexPathList.java:677)
at dalvik.system.DexPathList.findClass(DexPathList.java:466)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
Crash appears on this piece of code:
public void onCreate() {
super.onCreate();
.......................
db = Room.databaseBuilder(getApplicationContext(),
AppDatabase.class, "database-name")
.fallbackToDestructiveMigration()
.build(); // on this line
.............................
Also it appears in another place, just in first line of launching activity onCreate() method.
Here is my whole dependency list:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Required for local unit tests (JUnit 4 framework)
implementation "com.android.support:support-v4:28.0.0"
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.17.0'
//Room
implementation "android.arch.persistence.room:runtime:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"
// Required for instrumented tests
androidTestImplementation "com.android.support:support-annotations:$supportVersion"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.afollestad.material-dialogs:core:0.9.5.0'
//social networks
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
//support libs
implementation 'com.android.support:multidex:1.0.3'
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:cardview-v7:28.0.0"
implementation "com.android.support:customtabs:28.0.0"
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support:design:28.0.0"
implementation "com.android.support:percent:28.0.0"
//google libs
implementation "com.google.firebase:firebase-messaging:17.4.0"
implementation "com.google.firebase:firebase-core:16.0.7"
implementation "com.google.android.gms:play-services-location:$googleVersion"
implementation 'com.google.android.play:core:1.6.5'
//cupboard
implementation 'nl.qbusict:cupboard:2.2.0'
implementation 'nl.littlerobots.cupboard-tools:gson:0.3.1'
implementation 'com.github.smart-fun:XmlToJson:1.4.4'
//rest
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.squareup.okhttp:okhttp:2.7.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.1'
//MVP
implementation "com.arello-mobile:moxy:$moxyVersion"
implementation "com.arello-mobile:moxy-app-compat:$moxyVersion"
kapt "com.arello-mobile:moxy-compiler:$moxyVersion"
//butter
implementation "com.jakewharton:butterknife:$butterKnifeVersion"
kapt "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
//animation
implementation 'com.andkulikov:transitionseverywhere:1.7.6'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'joda-time:joda-time:2.9.9'
implementation 'com.romandanylyk:pageindicatorview:0.2.0'
implementation 'com.github.markomilos:paginate:0.5.1'
implementation 'com.splunk.mint:mint:5.0.0'
implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.3'
implementation group: 'com.jakewharton.rxrelay', name: 'rxrelay', version: '1.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation('com.journeyapps:zxing-android-embedded:3.6.0') { transitive = false }
implementation 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
implementation 'me.relex:circleindicator:1.2.2#aar'
implementation 'com.birbit:android-priority-jobqueue:2.0.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.github.jakob-grabner:Circle-Progress-View:v1.3'
implementation 'com.github.javiersantos:BottomDialogs:1.2.1'
implementation 'com.github.zcweng:switch-button:0.0.3#aar'
implementation 'jp.wasabeef:blurry:2.1.1'
implementation 'co.infinum:goldfinger:1.1.1'
implementation 'co.infinum:goldfinger-rx:1.1.1'
implementation "android.arch.work:work-runtime:1.0.1"
implementation "ru.tinkoff.decoro:decoro:1.3.4"
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.github.GoodieBag:Pinview:v1.3'
implementation 'com.beust:klaxon:3.0.1'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.2.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true
}
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation project(':bottom-navigation-bar-release')
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.squareup.whorlwind:whorlwind:2.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.4.4'
implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
implementation group: 'org.simpleframework', name: 'simple-xml', version: '2.7'
//App icon badge related library dependency
implementation "me.leolin:ShortcutBadger:1.1.22#aar"
implementation 'com.thoughtbot:expandablecheckrecyclerview:1.4'
// Range seekbar library dependency
compile 'com.crystal:crystalrangeseekbar:1.1.3'
implementation 'android.arch.persistence.room:rxjava2:1.1.1'
// Date and Time picker dialog
implementation 'com.github.florent37:SingleDateAndTimePicker:v2.0.4'
}

Program type already present: androidx.recyclerview.widget.AdapterHelper$Callback

i have a R8 error in android studio with same error:
Program type already present: androidx.recyclerview.widget.AdapterHelper$Callback
this is my gradle dependencies:
dependencies {
implementation 'androidx.core:core:1.2.0-beta01'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0-rc01'
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-config:19.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-vision:16.2.0'
implementation 'com.google.android.gms:play-services-wallet:17.0.0'
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'net.hockeyapp.android:HockeySDK:5.2.0'
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.android.material:material:+'
implementation files('libs/android-viewbadger.jar')
implementation 'com.android.support:multidex:+'}
i must add:
implementation 'com.google.android.material:material:+'
or:
implementation 'com.android.support:design:+'
for use TabLayout
but when i add that's implementation , i get that error.
Exclude packages :
implementation('com.google.android.material:material:+') {
exclude group: 'androidx.recyclerview'
}

Issue with importing a Gradle project for XNAT - unresolved type

I trying to import a Gradle project for XNAT for the first time using Eclipse 2018-12. I created the project, right clicked, chose Gradle then Existing Gradle Project. After the import completed there is an error with SimpleUploadPlugin.java - "The type org.apache.ecs.ConcreteElement cannot be resolved. It is indirectly referenced from required .class files". I have checked and I have the commons-lang3-3.8.1.jar.
What do I need to do to resolve this issue please?
My build.gradle dependencies are:
// TODO: This is a pretty minimal set of dependencies, so don't worry if you need to add more.
dependencies {
implementation("org.nrg.xnat:web") {
transitive = false
}
implementation("org.nrg.xnat:xnat-data-models") {
transitive = false
}
implementation("org.nrg.xdat:core") {
transitive = false
}
implementation "org.nrg:prefs"
implementation "org.nrg:framework"
implementation("turbine:turbine") {
transitive = false
}
implementation("org.apache.velocity:velocity") {
transitive = false
}
implementation("stratum:stratum") {
transitive = false
}
implementation "log4j:log4j"
implementation "io.springfox:springfox-swagger2"
compile group: 'ecs', name: 'ecs', version: '1.4.2'
}
Another option is to change the dependency configuration for org.nrg.xnat:web from compile or implementation to compileOnly. This lets you declare fewer dependencies for your plugin because you can allow transitive dependencies. The ECS dependency comes from classes in XNAT itself, so allowing the transitive dependencies means you don't have to declare everything that might be indirectly referenced. I just made this change in the XNAT LDAP authentication plugin and went from this:
implementation("org.nrg.xnat:web") {
transitive = false
}
implementation("org.nrg.xnat:xnat-data-models") {
transitive = false
}
implementation("org.nrg.xdat:core") {
transitive = false
}
implementation("org.nrg:prefs") {
transitive = false
}
implementation("org.nrg:framework") {
transitive = false
}
implementation "org.springframework:spring-web"
implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-ldap"
implementation "org.apache.commons:commons-lang3"
implementation "org.hibernate.javax.persistence:hibernate-jpa-2.1-api"
implementation "com.google.guava:guava"
implementation "org.slf4j:slf4j-api"
implementation "log4j:log4j"
implementation "org.springframework.security:spring-security-web"
implementation "javax.servlet:javax.servlet-api"
compileOnly "com.google.code.findbugs:jsr305"
compileOnly "org.apache.ivy:ivy:2.4.0"
compileOnly("stratum:stratum") {
transitive = false
}
To this:
compileOnly "org.nrg.xnat:web"
compileOnly "org.springframework.security:spring-security-ldap"
compileOnly "org.slf4j:slf4j-nop"
If you run this:
$ ./gradlew dependencies
You'll see that ecs:ecs:1.4.2 gets pulled in through a number of transitive dependencies.
org.apache.ecs.ConcreteElement is from the Apache Element Construction Set (ECS) and for example contained in ecs-1.4.2.jar.
To resolve the issue add a dependency to your build.gradle file like the following:
// https://mvnrepository.com/artifact/ecs/ecs
compile group: 'ecs', name: 'ecs', version: '1.4.2'

Dagger build error

I've got two objects which I inject with dagger2 without any problems. When I add third one (the same way like two before), project does not rebuild and gives errors, that points into first two (nothing here about added third one):
error: com.google.firebase.database.DatabaseReference cannot be provided without an #Inject constructor or from an #Provides- or #Produces-annotated method.
com.google.firebase.database.DatabaseReference is injected at
com.hotmail.at.jablonskimichal.dni.wolne.od.handlu.ui.splash.SplashPresenter.freeDaysCloudReference
com.hotmail.at.jablonskimichal.dni.wolne.od.handlu.ui.splash.SplashPresenter is injected at
com.hotmail.at.jablonskimichal.dni.wolne.od.handlu.providers.components.MainPresenterComponent.inject(destination)
Every three modules and components are implemented in the same way. Of course when I delete added third one, projects compiles easily.
Module which messes project build:
#Module
public class MainPresenterModule {
private final MainPresenter presenter;
public MainPresenterModule(MainPresenter presenter) {
this.presenter = presenter;
}
#Singleton
#Provides
MainPresenter provideMainPresenter() {
return presenter;
}
}
Component:
#Singleton
#Component(modules = {MainPresenterModule.class})
public interface MainPresenterComponent {
void inject(SplashPresenter destination);
}
Maybe useful:
I am using those libraries for DI with dagger2:
implementation 'com.google.dagger:dagger-android:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
with newest android studio (3.1.1) and gradle (3.1.1) on mac osx. Of course I've tried invalidating cache and restarts, cleans etc. I've checked imports and all of them are the same.
Edit:
When I remove usage of injection
#Inject
DatabaseReference shopsCloudReference;
public MainPresenter(MainController controller) {
super(controller);
Core.injectShopsComponent().into(this);
}
And
#Inject
DatabaseReference freeDaysCloudReference;
public SplashPresenter(SplashController controller) {
super(controller);
Core.injectFreeDaysComponent().into(this);
}
project compiles, but it is not what I wanted.
EDIT
There's lot of answers that I didn't add firebase libs in gradle. My full gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.hotmail.at.jablonskimichal.dni.wolne.od.handlu"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
allprojects {
repositories {
mavenCentral()
google()
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//tests
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'
//support
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
//images loading
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
//network
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
//json parsing
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.google.code.gson:gson:2.8.0'
//for view bindings
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//rxjava
def rxVersion = '2.0.2'
implementation "io.reactivex.rxjava2:rxandroid:$rxVersion"
implementation "io.reactivex.rxjava2:rxjava:$rxVersion"
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
//dagger
implementation 'com.google.dagger:dagger-android:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
//google
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
//datetime
implementation group: 'joda-time', name: 'joda-time', version: '2.9.9'
//transitions
implementation "com.andkulikov:transitionseverywhere:1.7.9"
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
Well, you wrote :
#Component(modules = {MainPresenterComponent.class})
It should be :
#Component(modules = {MainPresenterModule.class})

Categories