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.
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
You would probably want to update this to match the SDK corresponding to the Platform of the device you are targeting. In my case I am targeting Platform 29, and in my /build-tools/ directory I find a "/29.0.3/" directory (among others).. So, I edited my build.gradle
:
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 29
compileSdkVersion = 29
targetSdkVersion = 29
.. after my edit I was able to successfully build and deploy to my Android device again.
You may need to update your SDK, as well. I experienced this on a project which was building just fine for over a year, then I updated expo-gl-cpp
package (and a few others) and immediately had the same problem/error you are having. I had to update my SDK for Platform 29 and then modify my build.gradle
settings before I was up and running again. I use Android Studio to manage my SDKs, it's all point-and-click, easy to use. I don't use it for anything else, never had the need.
HTH!
I have solved this issue by downgrading react-native-unimodules from version 0.13.2 to 0.12.0
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.
"expo": "~44.0.0",
https://github.com/expo/expo/tree/sdk-{version}/packages
. (Mine was
https://github.com/expo/expo/tree/sdk-44/packages).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
npm install [email protected]
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With