I try to implement the code described in the "java with callbacks" section of the document in https://developer.android.com/guide/topics/large-screens/make-apps-fold-aware.
But ActivitySplitLayoutBinding is unresolved.
Here is an extract of my build.gradle file:
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.core:core:1.7.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.9'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation "androidx.window:window:1.0.0"
implementation "androidx.window:window-java:1.0.0"
implementation "androidx.window:window-rxjava2:1.0.0"
implementation 'androidx.startup:startup-runtime:1.1.1'
implementation 'androidx.navigation:navigation-fragment:2.4.1'
implementation 'androidx.navigation:navigation-ui:2.4.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
implementation 'com.opencsv:opencsv:5.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
What am I missing?
ActivitySplitLayoutBinding is not coming from any library but is just a view bindings definition linked to a xml layout.
E.g. in this sample, there will be a .xml named activity_split_layout.xml when you use ViewBindings, then you will have a definition named ActivitySplitLayoutBinding in your Activity class, so you can access to all its views from the layout.
You can learn more about ViewBindings here: https://developer.android.com/topic/libraries/view-binding
Hope that this helps.
-Cesar
Related
I believe I've latest dependencies and gradle. When I extend my Activity (ProfileActivity) from AppCompatActivity and try to access registerForActivityResult like this -
// not working
private val pickSingleImageLauncher =
registerForActivityResult(ActivityResultContracts.PickVisualMedia()) { // my code }
Getting error Unresolved reference: registerForActivityResult
I can solve this issue by extending ComponentActivity instead AppCompatActivity but since I also need to use supportFragmentManager. And error goes vice-versa
So How can I use both in my Activity (ProfileActivity.kt)
I've the following build.gradle (:app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
android {
...
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
implementation "androidx.activity:activity-ktx:1.6.1"
implementation "androidx.fragment:fragment-ktx:1.5.4"
}
And this is build.gradle (MyApp)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}
So far I know that AppCompatActivity extend FragmentActivity which extend ComponentActivity
I think there are 2 types ComponentActivity so these things are confusing don't you think!
Any help will always be appreciated!
I want to implement a GraphQL spring-webflux based application.
I have tried code as shown in the sample : https://github.com/graphql-java-kickstart/samples/tree/master/spring-boot-webflux
The query "hello" is returning the toString() value of Mono and not the String that Mono is holding:
hello Query
If I try a Mono of a custom object (Item here), I get an error like below:
graphql.kickstart.tools.ResolverError: Expected source object to be an instance of 'com.example.demo.pojo.Item' but instead got 'reactor.core.publisher.MonoJust'
My build.gradle file is as below:
plugins {
id 'org.springframework.boot' version '2.5.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'com.graphql-java-kickstart:graphql-spring-boot-starter:11.0.0'
compileOnly 'com.graphql-java-kickstart:graphql-java-tools:11.0.1'
runtimeOnly 'com.graphql-java-kickstart:graphiql-spring-boot-starter:11.0.0'
runtimeOnly 'com.graphql-java-kickstart:voyager-spring-boot-starter:11.0.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
Returning a CompletableFuture works but I would prefer using Mono/Flux.
Would appreciate any sample/pointer on using webflux with GraphQL.
The issue was due to the incorrect dependencies. The sample is may be outdated. Below is what worked for me in case someone finds it helpful:
in build.gradle:
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'com.graphql-java-kickstart:graphql-kickstart-spring-boot-starter-webflux:11.1.0'
implementation 'com.graphql-java-kickstart:graphql-kickstart-spring-boot-starter-tools:11.1.0'
This is able to handle reactive return types in GraphQL response.
Thanks for anyone who spent time on this.
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'
}
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'
}
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