https://kotlinlang.org
Join Slack
Hey all, so I've had this issue happen on both a personal project now and our work project where we ...
j

Josh Eldridge

over 2 years ago
Hey all, so I've had this issue happen on both a personal project now and our work project where we just brought kotlin multiplatform in, but local builds will build fine but it specifically fails on CI, I've seen this same error happen in a github action and gitlab CI environment when trying to go from kotlin
1.7.10
to
1.7.20
but the stack trace hasn't been super helpful into hunting down exactly why the CI can't find
1.7.20
attaching stack trace in thread:
j
t
  • 2
  • 10
  • 715
I'm struggling with providing instances of Beans for SpringBoot tests, can anyone see what I'm doing...
d

dr.dreigh

over 5 years ago
I'm struggling with providing instances of Beans for SpringBoot tests, can anyone see what I'm doing wrong please:
@SpringBootApplication
class DemoApplication

fun main(args: Array<String>) {
    runApplication<DemoApplication>(*args)
}

@Component
class NormalComponent() {
    fun value() = "Hi"
}
Test:
@TestConfiguration
class TestConfig {

	@Bean
	fun normalComponentMock(): NormalComponent {
		val mock =  mock(NormalComponent::class.java)
		`when`(mock.value()).thenReturn("I AM A MOCK!")
		return mock
	}
}

@SpringBootTest
@Import(TestConfig::class)
class DemoApplicationTests(
	@Autowired val norm: NormalComponent
) {
	@Test
	fun normInjectedIntoTest() {
		assertEquals("I AM A MOCK!", norm.value())
	}
}
The error:
org.junit.jupiter.api.extension.ParameterResolutionException: Failed to resolve parameter [com.example.demo.NormalComponent norm] in constructor [public com.example.demo.DemoApplicationTests(com.example.demo.NormalComponent)]: No qualifying bean of type 'com.example.demo.NormalComponent' available: expected single matching bean but found 2: normalComponent,normalComponentMock
I know I could use
@MockBean
- this is just a simple example where the bean I want to inject to the instance. Bit confused why the mock conflict is happening when I have using the
@TestConfiguration
and the
@Import
annotation - thanks in advance 🙏
d
k
+2
  • 4
  • 19
  • 714
Perhaps a silly question, but what is the criteria for `TooGenericExceptionCaught`? It's flagging th...
r

Richard Gomez

almost 3 years ago
Perhaps a silly question, but what is the criteria for
TooGenericExceptionCaught
? It's flagging this as being too generic, but
IndexOutOfBoundsException
seems pretty appropriate. https://github.com/rgmz/NewPipe/blob/75917c7f61cde0537075b3e1c5442cdf27755026/app/src/main/java/org/schabi/newpipe/info_list/StreamSegmentAdapter.kt#L54
r
s
  • 2
  • 4
  • 713
I am having a problem with NavGraph whereby using nested graphs gives me the following obscure error...
u

0xf1f1

over 1 year ago
I am having a problem with NavGraph whereby using nested graphs gives me the following obscure error:
java.lang.IllegalArgumentException: Destination Destination(0x4270f667) route=/login cannot have the same route as graph ComposeNavGraph(0x4270f667) route=/login startDestination=0x0
u
b
s
  • 3
  • 24
  • 712
I'm getting a few ANRs reported by Android for *`WaitForOtherNonDaemonThreadsToExit` in each case I ...
t

Tolriq

about 2 years ago
I'm getting a few ANRs reported by Android for
WaitForOtherNonDaemonThreadsToExit
in each case I have an OkHttp thread running. Any knowledge about such kind of issues ?
Anr:
#00  pc 0x000000000004e8f0  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+32)
  #01  pc 0x00000000003a9ae4  /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+140)
  #02  pc 0x00000000007267c0  /apex/com.android.art/lib64/libart.so (art::ThreadList::WaitForOtherNonDaemonThreadsToExit(bool)+336)
  #03  pc 0x000000000034dc20  /apex/com.android.art/lib64/libart.so (art::JII::DestroyJavaVM(_JavaVM*)+32)
  #04  pc 0x00000000000ce520  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+1032)
  #05  pc 0x0000000000002570  /system/bin/app_process64 (main+1304)
  #06  pc 0x000000000004a7d4  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+100)
Thread code in thread.
t
y
  • 2
  • 14
  • 712
[SOLVED] Is there a way to draw an ImageVector into Canvas? Particularly, I want to draw an Icon. I ...
d

Denis

over 4 years ago
[SOLVED] Is there a way to draw an ImageVector into Canvas? Particularly, I want to draw an Icon. I see
drawImage
method, but it accepts only an ImageBitmap. Probably I need to convert ImageVector to ImageBitmap, but I don't understand how
d
n
n
  • 3
  • 10
  • 712
any reason why I can’t find the `weight` Modifier? just goes unresolved, no hint to import or anythi...
o

oday

over 3 years ago
any reason why I can’t find the
weight
Modifier? just goes unresolved, no hint to import or anything, using Compose
1.0.5
o
z
+2
  • 4
  • 9
  • 711
Any ideas why I get unresolved reference jupiter, RegisterExtension and Test when running the test? ...
l

Lilly

over 3 years ago
Any ideas why I get unresolved reference jupiter, RegisterExtension and Test when running the test? Android Studio does not complain, nothing is marked as unresolved.
import de.datacollect.protocol.di.protocolModule
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.RegisterExtension
import org.koin.test.check.checkKoinModules
import org.koin.test.junit5.AutoCloseKoinTest
import org.koin.test.junit5.mock.MockProviderExtension


class CheckModulesTest : KoinTest {

    @JvmField
    @RegisterExtension
    val mockProvider = MockProviderExtension.create { clazz ->

    }

    @Test
    fun verifyKoinApp() {
        checkKoinModules(modules = protocolModule)
    }
}

build.gradle.kts:
plugins {
   kotlin("jvm")
   `java-library`
}

depnedencies {
  // Koin Core features
  implementation "io.insert-koin:koin-core:$koin_version"
  // Koin Test features
  testImplementation "io.insert-koin:koin-test:$koin_version"
  testImplementation "io.insert-koin:koin-test-junit5:$koin_version"
}
l
a
g
  • 3
  • 3
  • 710
I have a Scaffold with a TopAppBar. How do you make the bar's background color go all the way to top...
r

robnik

about 4 years ago
I have a Scaffold with a TopAppBar. How do you make the bar's background color go all the way to top edge of screen?
r
b
j
  • 3
  • 11
  • 710
Hello! Anyone else has issues with xcode 16? Updated xcode and my project running on kotlin 1.9.24, ...
e

Edgars Malahovskis

10 months ago
Hello! Anyone else has issues with xcode 16? Updated xcode and my project running on kotlin 1.9.24, fails to build with : Exception in thread “main” java.lang.Error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/usr/include/copyfile.h3510: fatal error: ‘sys/cdefs.h’ file not found Any advice would be appreciated.
e
f
+2
  • 4
  • 14
  • 709
Previous697071Next

kotlinlang

A modern programming language that makes developers happier.

Powered by