728x90

Type 'State<List?>' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate

 

아래의 두가지 상황일 경우, 에러 발생

Code

@Composable
fun UserScreen(userViewModel:UserViewModel){
    val items: List<User> by userViewModel.fetchUserList.observeAsState()
    UserList(userList = items)
}


@Composable
fun UserScreen(){
 	var value by remember { mutableStateOf("") }
   
}

 

 

방법1

import androidx.compose.runtime.getValue

import androidx.compose.runtime.livedata.observeAsState

 

 

방법2

// for a 'val' variable
import androidx.compose.runtime.getValue

// for a `var` variable also add
import androidx.compose.runtime.setValue

// or just
import androidx.compose.runtime.*

 

 

출처: https://stackoverflow.com/questions/63875411/type-statelistuser-has-no-method-getvaluenothing-kproperty-and-t

728x90
728x90

 

해결방법

 

1. Build > Clean Project 

2. File > Invalidate Caches / Restart Project

 
728x90
728x90

이클립스 실행하자마자 응답 없음에 걸릴 경우

 

 

1. STS실행파일과 같은 위치에 있는 'STS.init'파일에 본인 컴퓨터의 JAVA PATH를 추가

 

-vm

C:\Program Files\Java\jre1.8.0_171\bin\javaw.exe

 

(*vmargs 위에 추가)

 

 

2. 내가 해결본 방법

최근 실행한 프로젝트의 설정값이 남아서 에러가 나는 것이므로,

workspace를 재구성하기 위해 Package Explorer를 완전히 비우고(실제 소스파일들을 삭제하란 소리는 아님),

프로젝트 파일들을 다시 불러오자

 

 

 

estrella-0707.tistory.com/11

http://dev.azki.org/42

http://off-topic.biz/en/eclipse-hangs-at-startup-showing-only-the-splash-screen/

 

 

 

728x90
728x90

[Android Error] Location specified by ndk.dir did not contain a valid NDK and and couldn't be used

 

 

원인: 안드로이드 프로젝트 내부의 NDK 경로 변경으로 인한 문제
  

찾아본 해결방법
1)  파일 위치: local.properties (SDK Location)
 수정할 부분: ndk.dir = 설정된 NDK 경로를 바뀐 NDK 경로로 변경하여준다.

==>내 경우는 이렇게 했는데도 경로 갱신이 제대로 안되던데
2) SDK Manager에서 ndk 버전 마저 다 다운받고, Proejct Structure에서 해당버전으로 ndk 폴더경로 선택후 다시 build sync project하고 됨

 

 

 

Reference

hoyi327.tistory.com/45

 

728x90

+ Recent posts