arcore_flutter_plugin icon indicating copy to clipboard operation
arcore_flutter_plugin copied to clipboard

Unable to detect ARCore even when its apk is installed

Open abhishekdv1 opened this issue 2 years ago • 11 comments

I'm trying to test out an minimal example that uses your library but always end up with a Google Play installation overlay (even if Google Play Services for Augumented is already installed') which is followed by a "Handle exception: null" toast, which indicates that an com.google.ar.core.exceptions.UnavailableUserDeclinedInstallationException was thrown

Here's our main.dart code:

//ignore_for_file: no_leading_underscores_for_local_identifiers, unused_element, unused_local_variable

import 'dart:ffi';

import 'package:flutter/material.dart';
import 'package:arcore_flutter_plugin/arcore_flutter_plugin.dart';
import 'package:vector_math/vector_math_64.dart' as vector;

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;
  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  ArCoreController? arCoreController;

  _onArCoreViewCreated(ArCoreController _arcoreController) {
    arCoreController = _arcoreController;
    _addSphere(arCoreController!);
  }

  _addSphere(ArCoreController _arcoreController) {
    final material = ArCoreMaterial(color: Colors.redAccent);
    final sphere = ArCoreSphere(materials: [material], radius: 0.5);
    final node = ArCoreNode(
      shape: sphere,
      position: vector.Vector3(
        0,
        0,
        -1,
      ),
    );

    _arcoreController.addArCoreNode(node);
  }

  @override
  void dispose() {
    arCoreController?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: ArCoreView(
        onArCoreViewCreated: _onArCoreViewCreated,
      ),
    );
  }
}

The rest of the installation procedure was followed from the suggested medium article: https://medium.com/@difrancescogianmarco/arcore-flutter-plugin-configurations-3ee53f2dc749

Is there any way we could please fix this issue? We have confirmed from the Settings > Apps section too that the Google Play Services for AR is installed on the target device and othjer AR apps from Play store too work as expected

Thanks a lot in advance!

abhishekdv1 avatar Feb 12 '23 20:02 abhishekdv1

same problem

GoodMorrrrning avatar Feb 16 '23 12:02 GoodMorrrrning

I am having the same problem, did you manage to fix it yet?

JanSeibicke avatar Feb 22 '23 18:02 JanSeibicke

Stuck with the same issue Not even able to make the example work

hasnentai avatar Feb 23 '23 10:02 hasnentai

For everyone still wondering I found a solution that works for me.

The example project worked after i installed a Pixel 4 API 29 Emulator in Android Studio using the current version of Google Play Services for AR.

I was trying to make it work on emulators and physical devices that all used APIs above 30 which makes me believe that the APIs below 30 work just fine with this plugin

JanSeibicke avatar Feb 23 '23 12:02 JanSeibicke

Thanks @JanSeibicke I will try it out

hasnentai avatar Feb 27 '23 11:02 hasnentai

Did it work @hasnentai ?

abhishekdv1 avatar Mar 25 '23 17:03 abhishekdv1

@olexale Please help in this issue most of the people are facing this Issue

Marmik123 avatar Apr 17 '23 06:04 Marmik123

@abhishekdv1 I din tried this lib I tried out the DeepAR to make it work which is not free

hasnentai avatar Apr 26 '23 13:04 hasnentai

@abhishekdv1 Change targetSdkVersion to targetSdkVersion 28, it works for me.

farinchan avatar Apr 29 '23 12:04 farinchan

@abhishekdv1 Change targetSdkVersion to targetSdkVersion 28, it works for me.

while this can work you won't be able to publish your app on google play store as they require you target at least a two year old version from the current version, which right now means u must target API level 30

Yacine-Benali avatar May 27 '23 15:05 Yacine-Benali