1

I recently got the Mail due to Google regulations. I need to support my App to the newest API-Level 35 (Android 35). I'm now wondering if it is enough to set the targetdSdkVersion=35 and still use the compileSdkVersion=34 in my app.config.js.

Something like that:

    'expo-build-properties',
    {
      android: {
        compileSdkVersion: 34,
        targetSdkVersion: 35,
        buildToolsVersion: '35.0.0',
      },

Or do I need to upgrade my Expo-Version to 52.0.0? Due to this article: https://docs.expo.dev/versions/latest/

Setting the compileSdkVersion to 34 and targetSdkVersio: 35

3 Answers 3

3

You can't specify targetSdkVersion > compileSdkVersion. Because essentially targetSdkVersion says that I support this version, but for there to be real support it must be compiled with the corresponding version of compileSdkVersion

is it necessary to upgrade expo? generally no, although this is rather a desirable path. I specifically got one error compiling Kotlin in expo-modules-core:compileReleaseKotlin, I fixed it directly in node_modules and everything compiled fine

I had an error in this file node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt

and replaced a piece of code from:

override fun isPermissionPresentInManifest(permission: String): Boolean {
      try {
       context.packageManager.getPackageInfo(context.packageName, PackageManager.GET_PERMISSIONS)?.run {
        return requestedPermissions.contains(permission)
       }
       return false
    } catch (e: PackageManager.NameNotFoundException) {
        return false
     }
  }

to:

  override fun isPermissionPresentInManifest(permission: String): Boolean {
    try {
      val packageInfo = context.packageManager.getPackageInfo(
        context.packageName, 
        PackageManager.GET_PERMISSIONS
      )
      return packageInfo?.requestedPermissions?.contains(permission) ?: false
    } catch (e: PackageManager.NameNotFoundException) {
      return false
    }
  }
Sign up to request clarification or add additional context in comments.

4 Comments

hi @Webkadiz, could u share how did you fix and patch the issue? recently I got stack in that issue
This has fixed my issue after upgrading the Android SDK to 35. Thanks a lot.
Perfect, it works thanks
Replace the method worked for me too. It solves the issue locally to keep working. We need to share the work around with your team. Thanks!
0

**Yes Its Possible:

Go to android > build.gradle file:**

buildToolsVersion = findProperty('android.buildToolsVersion') ?: '35.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '35')
        kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23'

        ndkVersion = "26.1.10909125"

**FOR YOUR INFO:

SET:**

1. buildToolsVersion: 35
2. compileSdkVersion: 34
3. targetSdkVersion: 35

**
Same in app.json file**

Comments

0

Alternatively, the permission fix can be set as a patch:

# PATCH FOR EXPO SDK 51 - KOTLIN NULL-SAFETY FIX
# This patch can be removed when upgrading to Expo SDK 52
#
# Issue: [email protected] has a Kotlin null-safety violation in PermissionsService.kt
# that causes compilation errors with Kotlin 1.9.x
#
# Fix: Added safe call operator (?.) to handle nullable requestedPermissions array


diff --git a/node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt b/node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt
index ae0a811..180b46c 100644
--- a/node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt
+++ b/node_modules/expo-modules-core/android/src/main/java/expo/modules/adapters/react/permissions/PermissionsService.kt
@@ -163,7 +163,7 @@ open class PermissionsService(val context: Context) : InternalModule, Permission
   override fun isPermissionPresentInManifest(permission: String): Boolean {
     try {
       context.packageManager.getPackageInfo(context.packageName, PackageManager.GET_PERMISSIONS)?.run {
-        return requestedPermissions.contains(permission)
+        return requestedPermissions?.contains(permission) ?: false
       }
       return false
     } catch (e: PackageManager.NameNotFoundException) {
`

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.