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

Unable to detect ARCore even when its apk is installed #204

Open
abhishekdv1 opened this issue Feb 12, 2023 · 10 comments
Open

Unable to detect ARCore even when its apk is installed #204

abhishekdv1 opened this issue Feb 12, 2023 · 10 comments

Comments

@abhishekdv1
Copy link

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 abhishekdv1 changed the title Toast "Handle exception: null" appears even when ARCore installed Unable to detect ARCore even when its apk is installed Feb 12, 2023
@GoodMorrrrning
Copy link

same problem

@JanSeibicke
Copy link

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

@hasnentai
Copy link

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

@JanSeibicke
Copy link

JanSeibicke commented Feb 23, 2023

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

@hasnentai
Copy link

Thanks @JanSeibicke I will try it out

@abhishekdv1
Copy link
Author

Did it work @hasnentai ?

@Marmik123
Copy link

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

@hasnentai
Copy link

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

@farinchan
Copy link

farinchan commented Apr 29, 2023

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

@Yacine-Benali
Copy link

Yacine-Benali commented May 27, 2023

@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

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

No branches or pull requests

7 participants