Framework/Flutter

[Error]onRequestPermissionsResult is called without results. This is probably caused by interfering request codes.

  • -
반응형
테스트 환경
  • flutter 3.10.5
  • dart 3.0.5
  • flutter_local_notifications ^16.1.0
  • permission_handler ^11.0.1

 

로컬 푸쉬 기능을 넣기 위해 permission_handler 플러그인을 이용해 권한 설정을 추가하던 중 발생한 에러 내용입니다. 같은 내용으로 플러그인에 이슈가 추가된 것을 확인했습니다.

원인이 한가지는 아닐 수 있지만 저의 경우에는 compileSdkVersion과 targetSdkVersion이 상이해서 발생한 것으로 확인됩니다.

compileSdkVersion과 targetSdkVersion을 동일하게 맞추니 해결됐습니다.

 

before : build.gradle(:app)

android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

        // Local Notification
//        coreLibraryDesugaringEnabled true
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        applicationId "com.app.innerpeace"
        minSdkVersion 21
        targetSdkVersion 32
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

 

after: build.gradle(:app)

android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

        // Local Notification
//        coreLibraryDesugaringEnabled true
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        applicationId "com.app.innerpeace"
        minSdkVersion 21
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

 

 

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.app.innerpeace">

   <application
       android:label="오늘의평화"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher"
       android:usesCleartextTraffic="true">
       
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:showWhenLocked="true"
            android:turnScreenOn="true">

            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>

    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" android:minSdkVersion="33" />
    <uses-permission android:name="android.permission.INTERNET"/>


</manifest>
반응형
Contents

포스팅 주소를 복사했습니다.

이 글이 도움이 되었다면 공감 부탁드립니다.