expo: Multiple compile errors in - expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt

🐛 Bug Report

Compile error from expo-permissions, rebuild the dependencies and modules multiple time from scratch, but its the same. Code is a bit messy…

Task :expo-permissions:compileDebugKotlin FAILED e: C:\MyProjects\React\MobileReact\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (16, 40): Unresolved reference: PermissionAwareActivity e: C:\MyProjects\React\MobileReact\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (170, 17): Unresolved reference: PermissionAwareActivity e: C:\MyProjects\React\MobileReact\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (230, 19): Unresolved reference: PermissionAwareActivity e: C:\MyProjects\React\MobileReact\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (231, 62): Too many arguments for public final fun requestPermissions(@NonNull p0: Array<(out) String!>, p1: Int): Unit defined in android.app.Activity e: C:\MyProjects\React\MobileReact\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (231, 64): Cannot infer a type for this parameter. Please specify it explicitly. e: C:\MyProjects\React\MobileReact\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (231, 77): Cannot infer a type for this parameter. Please specify it explicitly. e: C:\MyProjects\React\MobileReact\node_modules\expo-permissions\android\src\main\java\expo\modules\permissions\PermissionsService.kt: (231, 97): Cannot infer a type for this parameter. Please specify it explicitly.

FAILURE: Build failed with an exception.

Environment

Expo CLI 3.20.0 environment info: System: OS: Windows 10 10.0.18363 Binaries: Node: 12.16.2 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - C:\Users\vvladislav\AppData\Roaming\npm\yarn.CMD npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6392135

Android App - trying to integrate tensorflow with react

Steps to Reproduce

Just create empty react native app and paste the code.

import React, { Component, useState, useEffect } from ‘react’; import { StyleSheet, Text, View, TouchableOpacity } from ‘react-native’; import { Camera } from ‘expo-camera’; import {Permissions} from ‘react-native-unimodules’;

import * as blazeface from ‘@tensorflow-models/blazeface’; import * as tf from ‘@tensorflow/tfjs’; import ‘@tensorflow/tfjs-react-native’; import ‘expo-asset’;

async function main() { console.debug(isTfReady); const model = await blazeface.load(); console.debug(model); // Pass in an image or video to the model. The model returns an array of // bounding boxes, probabilities, and landmarks, one for each detected face.

const returnTensors = false; // Pass in true to get tensors back, rather than values. const predictions = await model.estimateFaces(document.querySelector(“img”), returnTensors);

if (predictions.length > 0) { /* predictions is an array of objects describing each detected face, for example:

[
  {
    topLeft: [232.28, 145.26],
    bottomRight: [449.75, 308.36],
    probability: [0.998],
    landmarks: [
      [295.13, 177.64], // right eye
      [382.32, 175.56], // left eye
      [341.18, 205.03], // nose
      [345.12, 250.61], // mouth
      [252.76, 211.37], // right ear
      [431.20, 204.93] // left ear
    ]
  }
]
*/

for (let i = 0; i < predictions.length; i++) {
  const start = predictions[i].topLeft;
  const end = predictions[i].bottomRight;
  const size = [end[0] - start[0], end[1] - start[1]];

  // Render a rectangle over each detected face.
  ctx.fillRect(start[0], start[1], size[0], size[1]);
}

} }

export default class App extends Component {

constructor(props) {
    super(props);
    this.state = {
      isTfReady: false,
    };
	main();
}


render() {
	return (
		<View style={styles.container}>
			<Text style={styles.instructions}>{isTfReady} - Hello World :) :)</Text>
		</View>
		
				);
			}

}

const styles = StyleSheet.create({ container: { flex: 1, justifyContent: ‘center’, alignItems: ‘center’, backgroundColor: ‘#F5FCFF’ }, instructions: { textAlign: ‘center’, color: ‘#333333’, marginBottom: 5 } });

Expected Behavior

To have at least runtime error, not compile 😃

Actual Behavior

Compile time error

Reproducible Demo

Just paste the code in new react native App

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 16 (3 by maintainers)

Most upvoted comments

if log includes “Unresolved reference: R” update compileSdkVersion to 30

In my case… I solved the error :expo-permissions:compileDebugKotlin FAILED this way:

  1. Installing react-native-unimodules
  2. Configuration for Android

Same problem here. You can find stack trace here: https://pastebin.com/vqQw0NVs

I am using Expo bare workflow and latest version of unimodules and expo-permissions.

I’ve already tried to reinstall node_modules packages and run ‘gradle clean’.

Nothing helps, I am stuck. I must admit that I am new to react-native and could have missed something.

thanks for the repository! I tried it out but I could still not reproduce the compile issue. Tried it with both importing react-native-unimodules and expo-permissions (after installing it with expo install expo-permissions). Had to add a custom debug keystore and fix gradlew’s executing permissions, but those are probably my system only and not related.

Could you add tensorflow to the repro, maybe something weird is happening there that affects the expo-permissions/unimodules?