Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vladi-hub opened this issue Apr 30, 2020 · 16 comments
Labels

Comments

@vladi-hub
Copy link

🐛 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

@byCedric
Copy link
Member

Hi @vladi-hub! It looks like something is up with your react native package. Could you create a small example repo with this issue, that way we can investigate it a bit more. If not, I've seen a similar report here, maybe it helps. If not, you can try out one of the suggestions over here. Hope it helps!

@vladi-hub
Copy link
Author

yep I check those previous issues, not the same .... here is some more info:
nimodules-core@5.1.0 from C:\MyProjects\React\MobileReact\node_modules@unimodules\core
unimodules-react-native-adapter@5.2.0 from C:\MyProjects\React\MobileReact\node_modules\react-native-unimodules\node_modules@unimodules\react-native-adapter
expo-camera@8.2.0 from C:\MyProjects\React\MobileReact\node_modules\expo-camera
expo-constants@9.0.0 from C:\MyProjects\React\MobileReact\node_modules\expo-constants
expo-file-system@8.1.0 from C:\MyProjects\React\MobileReact\node_modules\expo-file-system
expo-gl-cpp@8.1.0 from C:\MyProjects\React\MobileReact\node_modules\expo-gl-cpp
expo-gl@8.1.0 from C:\MyProjects\React\MobileReact\node_modules\expo-gl
expo-image-loader@1.0.1 from C:\MyProjects\React\MobileReact\node_modules\expo-image-loader
expo-permissions@8.1.0 from C:\MyProjects\React\MobileReact\node_modules\expo-permissions
expo-updates@0.1.3 from C:\MyProjects\React\MobileReact\node_modules\expo-updates
unimodules-app-loader@1.0.1 from C:\MyProjects\React\MobileReact\node_modules\unimodules-app-loader
unimodules-barcode-scanner-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-barcode-scanner-interface
unimodules-camera-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-camera-interface
unimodules-constants-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-constants-interface
unimodules-face-detector-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-face-detector-interface
unimodules-file-system-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-file-system-interface
unimodules-font-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-font-interface
unimodules-image-loader-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-image-loader-interface
unimodules-permissions-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-permissions-interface
unimodules-sensors-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-sensors-interface
unimodules-task-manager-interface@5.1.0 from C:\MyProjects\React\MobileReact\node_modules\unimodules-task-manager-interface

c:\MyProjects\React\MobileReact>react-native -version
react-native-cli: 2.0.1
react-native: 0.61.5

@vladi-hub
Copy link
Author

@byCedric
Copy link
Member

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?

@vladi-hub
Copy link
Author

vladi-hub commented Apr 30, 2020 via email

@vladi-hub
Copy link
Author

@tensorflow/tfjs-react-native@0.2.3
npm tensorflow@ --version
6.14.4

npm tfjs -v
6.14.4

if you can't reproduce with those versions I will try to upload it, but its too much hassle

@vladi-hub
Copy link
Author

so are you able to actually build the apk ?

@arklanq
Copy link

arklanq commented Jun 30, 2020

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.

@GrabbenD
Copy link

I encountered a similar issue with Unresolved reference .. in expo-permissions and I managed to solve it in my environment. I noted down the general steps here: #10283 (comment)

@hrdyjan1
Copy link

hrdyjan1 commented Oct 6, 2020

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

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

@brentvatne
Copy link
Member

hi! we need a reproducible example to help with this. please create a new issue and provide an example that we can run to demonstrate the issue. this is likely a bug in your own code and trying to provide a minimal reproducible example will help you to locate that bug! if you can reproduce it then it'll help us to investigate! more guidance on how to do this if you need it: https://stackoverflow.com/help/minimal-reproducible-example

@SuhailBt
Copy link

SuhailBt commented Apr 6, 2021

How I fixed it:

  1. Installing react-native-unimodules
  2. Configuration for Android using the steps provided in link below
    https://docs.expo.io/bare/installing-unimodules/
    com.myapp should be your package name
  3. invalidate cache
  4. Delete .idea folder
  5. Delete node_modules
  6. npm i
  7. build again

@harshithq
Copy link

Downgrading "react-native-unimodules" to "0.12.0" worked for me,

@nawbc
Copy link

nawbc commented Apr 18, 2021

if log includes "Unresolved reference: R" update compileSdkVersion to 30

@joelsongsouzza
Copy link

if log includes "Unresolved reference: R" update compileSdkVersion to 30

This was the unique solution that worked for me, thanks!

@Jamie0
Copy link

Jamie0 commented Nov 8, 2022

If you've been having this issue since roughly the start of November, see facebook/react-native#35210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests