13

I am working on a React Native app where I included some expo libraries (bare workflow). I had successfully used expo-location, but now after I installed also expo-camera, the app won't build anymore with npm run android, did not try yet on ios.

It will crash at :expo-permissions:compileDebugKotlin step.

I did find the problem on another forum, they were saying to update the buildToolsVersion from build.gradle to 29.0.2 but it already was on 29.0.2. Then I updated react-native-unimodules which is required to use expo libraries and contains expo-permissions. It didn't work. Right now, my current versions of libs are:

"react-native-unimodules": "^0.12.0"

"expo-permissions": "~10.0.0"

"expo-camera": "^9.1.1"

Do you have any ideas? Did someone met this problem also?

Thanks

A more elaborate stacktrace is this:

Task :expo-permissions:compileDebugKotlin FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
153 actionable tasks: 4 executed, 149 up-to-date
e: app\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (16, 40): Unresolved reference: PermissionAwareActivity
e: app\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (170, 17): Unresolved reference: PermissionAwareActivity
e: app\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (236, 19): Unresolved reference: PermissionAwareActivity
e: app\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (237, 62): Too many arguments for public final fun requestPermissions(@NonNull p
0: Array<(out) String!>, p1: Int): Unit defined in android.app.Activity
e: app\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (237, 64): Cannot infer a type for this parameter. Please specify it explicitly.
e: app\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (237, 77): Cannot infer a type for this parameter. Please specify it explicitly.
e: app\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (237, 97): Cannot infer a type for this parameter. Please specify it explicitly.

FAILURE: Build failed with an exception.

Meisan Saba
  • 800
  • 2
  • 9
  • 25
chris chris
  • 131
  • 1
  • 1
  • 5

6 Answers6

5

You may not want to take the version being referenced by others online, but, instead take the version of what you have installed locally, which would vary depending on when you last updated your Android SDK.

On Windows you can look up your SDK version (tools version):

dir %ANDROID_SDK_ROOT%\build-tools

Probably *nix systems will have a similar SDK path (did not check):

ls -al $ANDROID_SDK_ROOT\build-tools
Shaun Wilson
  • 8,727
  • 3
  • 50
  • 48
  • I just used another lib because I didn't have enough time to continue investigating this, but thank you for your answer, maybe it will help somebody (y) – chris chris Mar 03 '21 at 13:26
  • I am beginner to react native , saw version 30 everywhere for react native vision camera inside node_modules folder, changed in my android/build.gradle and viola, it ran perfectly – Abhishek Mathur May 15 '21 at 16:19
  • I am getting the same error and i cannot solve it ,my build script is below? Could the problem be here? buildscript { ext { buildToolsVersion = "29.0.2" minSdkVersion = 21 compileSdkVersion = 29 targetSdkVersion = 29 } – Matt Laszcz Jun 29 '21 at 01:12
2

You might have installed a newer version of expo-camera. I've had the same issue with the expo-clipboard package.

My project was using expo@44 and I followed the official docs and ran npm install expo-clipboard which installed the latest version, which is compatible with the latest expo version at this time is expo@46.

The simple fix is to use the right version based on your expo version.

  1. Find your expo version in your package.json. Mine was "expo": "~44.0.0",
  2. Go to https://github.com/expo/expo/tree/sdk-{version}/packages. (Mine was https://github.com/expo/expo/tree/sdk-44/packages).
  3. Find the package you want to use like expo-clipboard and go to its package.json file to check the version Ex. https://github.com/expo/expo/blob/sdk-44/packages/expo-clipboard/package.json#L3
  4. Install that specific version npm install expo-clipboard@2.1.1

Hope it helps!

Domotor Zsolt
  • 586
  • 5
  • 10
1

I have solved this issue by downgrading react-native-unimodules from version 0.13.2 to 0.12.0

0

I solved this by downgrading react-native-unimodules from version 0.13.2 to 0.12.0, I think the problem is that the new version of unimodules requires upgrading your android build tools so the right thing is not downgrading the unimodules but upgrading your build tools from 28.0.0 to 29.0.3 like this:

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
Bogdan Oloeriu
  • 183
  • 2
  • 11
Hassan Kandil
  • 1,612
  • 1
  • 13
  • 26
  • Question: you mean downgrading the react-native-unimodules. Is this correct? Replacing this ` "react-native-unimodules": "^0.13.3",` with this? `"react-native-unimodules": "0.12.0",` – Bogdan Oloeriu Apr 17 '21 at 09:08
  • A: Removed the package with v 1.13.2 and installed the older version 1.12.0 – Hassan Kandil Apr 18 '21 at 09:48
  • There is no react-native-unimodules v 1.13.2. In fact, three is no version 1. We are still at version zero. What package are you talking about? https://www.npmjs.com/package/react-native-unimodules. Please be specific with the package name or family name. – Bogdan Oloeriu Apr 19 '21 at 07:18
  • 0.12.0 my bad , Edited the answer – Hassan Kandil Apr 19 '21 at 07:20
0

I got mine working by reducing my expo version from 43.0.0 to 40.0.0 and setting 'sdkVersion': "38.0.0". It appears the versions didn't match with each other or with some other expo dependencies.

in app.json:

{
  "name": "MyApp",
  "displayName": "MyApp",
      "expo": {
        "name": "MyApp",
        "slug": "myapp.app",
        "sdkVersion": "38.0.0"
      }
}

...and in package.json:

"dependencies" {
    "expo": "^40.0.0",
    "expo-file-system": "^9.3.0",
    "expo-linking": "~2.0.1",
    "expo-splash-screen": "~0.8.0",
    "expo-status-bar": "~1.0.3",
    "expo-updates": "^0.4.2",
}
Okpo
  • 375
  • 4
  • 9
0

I'm facing the same issue when I rebuild my project or try to run on a Device.

I install expo-permissions by using expo install expo-permissions on my expo project and then go to Android Studio and Sync my project after that I clean my project which you can find on build/Clean Project after this I install Kotlin extension on Android Studio after that again clean project and then rebuild Project (build/Rebuild Project).

These Steps resolve my issue.

Talha Akbar
  • 462
  • 3
  • 15