ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • java.lang.IllegalStateException : 함수를 찾을 수 없음 androidx.compose.internal.restartableFunctionInstance
    카테고리 없음 2020. 8. 9. 03:38

    질문

    앱을 실행하려고 할 때 다음과 같은 오류가 발생합니다.

    "java.lang.IllegalStateException: Function not found androidx.compose.internal.restartableFunctionInstance"

    및 다음 경고 :

    C:\Users\amr\.gradle\caches\transforms-2\files-2.1\29795ea219aedbe5401209deaa0aa414\jetified-kotlin-stdlib-jdk7-1.3.60-eap-25.jar: Runtime JAR file has version 1.3 which is older than required for API version 1.4

    활동의 내 코드는 다음과 같습니다.

    class MainActivity: AppCompatActivity() {
        override fun onCreate(savedInstanceState: Bundle ? ) {
            super.onCreate(savedInstanceState)
            setContent {
                Text("Hello World")
            }
        }
    }

    Android Studio 4.2 Canary 2를 사용하고 있습니다.

    다음은 전체 build.gradle 파일입니다. "

     apply plugin: 'com.android.application'
        apply plugin: 'kotlin-android'
        apply plugin: 'kotlin-android-extensions'
    
        android {
          compileSdkVersion 28
    
          defaultConfig {
            applicationId "com.example.myfirstCompse"
            minSdkVersion 21
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
    
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
          }
    
          buildTypes {
            release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
          }
    
          buildFeatures {
            compose true
          }
    
    
    
          compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
          }
    
          kotlinOptions {
            jvmTarget = "1.8"
          }
    
     composeOptions {
            kotlinCompilerExtensionVersion "0.1.0-dev09"
        }
    
        }
    
        dependencies {
          implementation fileTree(dir: 'libs', include: ['*.jar'])
          implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
          implementation 'androidx.appcompat:appcompat:1.1.0'
          implementation 'androidx.core:core-ktx:1.1.0'
          testImplementation 'junit:junit:4.12'
          androidTestImplementation 'androidx.test.ext:junit:1.1.1'
          androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    
          implementation 'androidx.ui:ui-framework:0.1.0-dev09'
        implementation 'androidx.ui:ui-tooling:0.1.0-dev09'
        implementation 'androidx.ui:ui-layout:0.1.0-dev09'
        implementation 'androidx.ui:ui-material:0.1.0-dev09'
    
    
        }

    업데이트 : 종속성 버전을 dev09로 변경하고 문서에서 제안하는대로 compileOptions 블록을 추가 할 때

    composeOptions {
            kotlinCompilerExtensionVersion "0.1.0-dev09"
        }

    다음과 같은 오류가 발생했습니다.

    e: java.util.NoSuchElementException: Collection contains no element matching the predicate.

    답변1

    composeOptions 클로저에 kotlinCompilerVersion = "1.3.70-dev-withExperimentalGoogleExtensions-20200424"를 추가합니다.

    composeOptions {
        kotlinCompilerVersion = "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
        kotlinCompilerExtensionVersion "0.1.0-dev09"
    }

    당신은 확실히 이것이 필요합니다; 이 특정 오류를 해결할지 확실하지 않습니다.

    프로젝트 수준 build.gradle 파일에서 사용중인 Kotlin의 버전을 확인할 수 있습니다. 1.3.70 은 알려진 안전한 버전입니다 (내 코드 snippet의 컴파일러 플러그인 버전과 일치).



     

     

     

     

    출처 : https://stackoverflow.com/questions/62459137/java-lang-illegalstateexception-function-not-found-androidx-compose-internal-re

    댓글

Designed by Tistory.