tomthecarrot / arcore-for-all

Google ARCore (dev preview 1) for "unsupported" Android devices
GNU General Public License v3.0
1.04k stars 145 forks source link

An UNSUPPORTED holiday gift from the ARCore team #139

Open inio opened 5 years ago

inio commented 5 years ago

Seasons greetings!

First off, I want to apologize for nerfing this project with ARCore 1.2. It was an unfortunate side effect of some important changes we had to make and wasn't intended to limit exploration. We think it's cool that users are so excited about ARCore that they're willing to jump through hoops to use it.

Now, on with the gift:

Though undocumented and totally unsupported, ARCore version 1.6 will look for a file at /data/data/com.google.ar.core/files/custom_device_profile.textproto before trying to load a profile normally from the database. This file has the same format as any other device profile and can be injected on a an unrooted device by using the backup/restore mechanism provided by adb as follows:

  1. Install the 1.6 ARCore APK.
  2. Use adb backup to back up com.google.ar.core.
  3. modify the backup to add the device profile at apps/com.google.ar.core/f/custom_device_profile.textproto. android-backup-extractor may be useful in doing the backup modifications, but be careful of the file order (see the documentation).
  4. Restore the modified backup.

Unfortunately 1.6 adds a wrinkle when figuring out the nearest profile to start from: device profile names are obfuscated. Here's a couple common places to start with (warning: these will probably change with each release):

Device Name Obfuscated Name
Pixel 1U-j16
Pixel 2 ggXzI1
S8 Exynos: zIGRDW Qualcomm: ngqwNz
S7 Exynos: Wvs3US Qualcomm: y3dvz_
S7 Edge Exynos: Qk0fSK Qualcomm: 6xH1dn

To build a bigger table, you should be able to find a logcat message that reports the name of the profile loaded, so get at it 😉.

Two final notes:

First, this only works on devices where the ARCore background process can run. We've seen some devices (mostly in China) with a security mechanism that prevents background apps without a launcher icon from running. On these devices the ARCore runtime can't access the ARCore ContentProvider, which prevents reading the profile from ARCore's data directory.

Finally, we really only intended this mechanism for internal development use. We're mentioning it here because we see users super excited about running ARCore on additional devices, and agree that having to root your phone to do that is dumb. That said, we really only want to expose this to users already familiar with adb, side-loading, rooting, and the instability and wackyness that can arise from those things. Don't go out of your way to make it easy for novice users run ARCore on unsupported devices, and don't ask for support through official channels. If either of those start happening, we may have to cripple or remove this capability, and I think that's a loss for everyone involved.

tomthecarrot commented 5 years ago

Thanks so much @inio! We really appreciate your gift and look forward to experimenting more with ARCore in a development setting :)

Happy Holidays!

faizanalibutt commented 5 years ago

2019-02-04 18:03:30.548 24736-24754/? I/native: device_profile_database_helpers.cc:296 Found nothing for device_profile_YttHJv 2019-02-04 18:03:30.548 24736-24754/? I/native: device_profile_database_helpers.cc:296 Found nothing for device_profile_WAS-LX1A_slash_HWWAS-H_accelerometer_null 2019-02-04 18:03:30.548 24736-24754/? I/native: device_profile_database_helpers.cc:296 Found nothing for device_profile_lsK4W9 2019-02-04 18:03:30.548 24736-24754/? I/native: device_profile_database_helpers.cc:296 Found nothing for device_profile_HWWAS-H_accelerometer_null 2019-02-04 18:03:30.548 24736-24754/? I/native: device_profile_database_helpers.cc:296 Found nothing for device_profile_N64zQ2 2019-02-04 18:03:30.548 24736-24754/? I/native: device_profile_database_helpers.cc:296 Found nothing for device_profile_WAS-LX1A 2019-02-04 18:03:30.548 24736-24754/? I/native: device_profile_database_helpers.cc:298 Could not locate device profile for HUAWEI/WAS-LX1A/HWWAS-H_accelerometer_null:8.0.0/HUAWEIWAS-LX1A/369(C185):user/release-keys

Kindly tell what should i do for this logcat to be successfull @tomthecarrot please advise.

inio commented 5 years ago

@tomthecarrot Small update: 1.7 (out today) leaves this mechanism unchanged, but switches the main profile database to something much more opaque. I made sure we included an example text-format proto in the assets directory, and I threw in a few hopefully-helpful comments.

tomthecarrot commented 5 years ago

Very cool. I'll check it out. Thanks @inio!

mwvent commented 5 years ago

Just wanted to thank you @inio - I just tried the example file you provided in 1.7 and tried it with Pokemon Go.

It worked completely unmodified ! ( Samsung Galaxy S6 ) - I could move closer to the 'mon and walk around, my daughter will be thrilled! Absolutely stunning work :-)

faizanalibutt commented 5 years ago

@mwvent can you please tel me how to do it. I'm stuck at the point where we add our device in custom_device_profile.textproto.

note: I'm able to get my device profile info from logcat

kindly assist me in this. Many Thanks. I have also s6.

faizanalibutt commented 5 years ago
Device Name Obfuscated Name
Pixel 1U-j16
Pixel 2 ggXzI1
S8 Exynos: zIGRDW Qualcomm: ngqwNz
S7 Exynos: Wvs3US Qualcomm: y3dvz_
S7 Edge Exynos: Qk0fSK Qualcomm: 6xH1dn
S6 Exynos: SKMoV6
S6 Exynos: 9Bf8uR

@inio @mwvent @tomthecarrot I'm creating this custom_device_profile.textproto file and saving data while fetching it from logcat. For s6. Please help me where i am doing wrong. Thanks.

this is the tar file order apps/com.google.ar.core/a/base.apk apps/com.google.ar.core/sp/phenotypeSharedPrefs.xml apps/com.google.ar.core/f/custom_device_profile.textproto apps/com.google.ar.core/_manifest

faizanalibutt commented 5 years ago

I have two phones huawei p10 lite with android O 8.0 and s6 with android N 7.0

mwvent commented 5 years ago

img_2019-02-15-23384558 @faizanalibutt - it doesn't look like you have to worry about device profile name at all. Just create apps/com.google.ar.core/f/custom_device_profile.textproto repack the tar ( the new file was last in order on mine ) and that device profile will be loaded first

I simply just extracted the apk and used the assets/device_profile_max_compatibility.textproto file for the custom_device_profile.textproto - it works pretty well with the S6 without making any changes although the only app I have tried is Pokemon GO. It's not quite the experience of a fully supported phone but way better then the 'standard' ar photo experience and I am happy with it.

faizanalibutt commented 5 years ago

@mwvent Many thanks for your reply. I will tell you after implementing it.

faizanalibutt commented 5 years ago

https://drive.google.com/open?id=1MOp6CXxNAABrBWpinWVqOZUO-VYNj8R_

@mwvent please see this video we don't need arcore application installed to run pokemon go. you can see in video. There are two apps. One is Aruler App Other is Pokemon GO Pokemon go is not dependent on ARCore. Although ArRuler App requires ARCore app installed. Can you please try ARruler app on your phone S6

faizanalibutt commented 5 years ago

@tomthecarrot @inio can you please help me on this. I'm not figuring out this thing. Thanks

mwvent commented 5 years ago

@faizanalibutt - The video link did not work. Anyhow Pokemon Go works without ARCore yes, but there are photography features that will only work when ARCore is installed. Without ARCore you get a Pokemon overlayed simply on your camera image, you can not walk closer to the Pokemon not take a picture from the side as I did above.

AR Ruler does run - the results are of course inaccurate - we are running ARCore uncalibrated after all! The inaccuracy is more then tolerable for taking pictures of Pokemon. I am currently running a mixture of old S7 profile from a previous ARCore APK and the device_profile_max_compatibility profile and will probably continue to try and have fun tweaking it for the duration of my devices lifespan.

I would try and respect @inio 's wish not to be hammered with requests for help with this - what has been done already is fantastic and gives us an opportunity to experience the tech and maybe figure some things out ourselves that we could not do otherwise. screenshot_20190220-131118

faizanalibutt commented 5 years ago

Thanks for your reply. I will look into it. I stopped working on it. Resume it the.

On Wed, Feb 20, 2019, 6:25 PM Matthew Watts <notifications@github.com wrote:

@faizanalibutt https://github.com/faizanalibutt - The video link did not work. Anyhow Pokemon Go works without ARCore yes, but there are photography features that will only work when ARCore is installed. Without ARCore you get a Pokemon overlayed simply on your camera image, you can not walk closer to the Pokemon not take a picture from the side as I did above.

AR Ruler does run - the results are of course inaccurate - we are running ARCore uncalibrated after all! The inaccuracy is more then tolerable for taking pictures of Pokemon. I am currently running a mixture of old S7 profile from a previous ARCore APK and the device_profile_max_compatibility profile and will probably continue to try and have fun tweaking it for the duration of my devices lifespan.

I would try and respect @inio https://github.com/inio 's wish not to be hammered with requests for help with this - what has been done already is fantastic and gives us an opportunity to experience the tech and maybe figure some things out ourselves that we could not do otherwise. [image: screenshot_20190220-131118] https://user-images.githubusercontent.com/1349580/53094763-fa81ba00-3512-11e9-9f08-2239626b01bf.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tomthecarrot/arcore-for-all/issues/139#issuecomment-465572387, or mute the thread https://github.com/notifications/unsubscribe-auth/AZf-ZJYZqWFzpVbPnoqp3GbMl8q29KZ6ks5vPUzQgaJpZM4ZhNpE .

DIGISHORT commented 5 years ago

@mwvent hello! I'm sorry to bother ya, but I have been trying to extract ar core 1.6 [downloaded from the developer's github] but all that appears is a _manifest file. actually backed up all my apps to be sure it was just that and most of my apps were properly backed. How did you do it? if you don't mind explaining

cridus commented 5 years ago

I know that github issues shouldn't be used as forum threads or such, but it took some time for me to figure out what to actually do to get ARCore working on my phone (for Pokémon GO's AR+, specifically), so I'm gonna write it here for others to come: (assuming you have a rooted phone):

Open Pokémon GO or whatever other app you want ARCore for, and the augmented reality features should be working (AR+, in case of Pokémon GO). If they don't, it means that you might have to tweak the "custom_device_profile.textproto" file. Good luck with that...

I'd like to thank @tomthecarrot, @inio, @mwvent and everyone else who worked on this project for allowing us to use ARCore on officially-unsupported devices.

DIGISHORT commented 5 years ago

So after installing ARCore, com.google.ar.core isn't showing up in my data folder As it should. It's probably why I keep getting 1kb backups so I'm kinda stumped asto what to do

faizanalibutt commented 5 years ago

I'm also getting 1kb backup data @DIGISHORT

immewnity commented 5 years ago

Looks like there's a bug with the latest adb versions - try 1.0.31 (https://archive.mozilla.org/pub/labs/android-tools/) or earlier.

faizanalibutt commented 5 years ago

I've done it. @immewnity @cridus @DIGISHORT Using my Huawei p10 lite android 8.0. Enjoy

https://github.com/tomthecarrot/arcore-for-all/issues/140

see above link

mwvent commented 5 years ago

Re the 1kb adb backups I found the only way to get it working with my adb version was to use the -apk flag with adb backup. Or was it the -system flag.. really should have wrote it down but it was one of the two :-)

DIGISHORT commented 5 years ago

Re the 1kb adb backups I found the only way to get it working with my adb version was to use the -apk flag with adb backup. Or was it the -system flag.. really should have wrote it down but it was one of the two :-)

I tried this just now but i continue getting the 1kb backup.. I almost had it working earlier but back to square one. :/ @mwvent

faizanalibutt commented 5 years ago

Re the 1kb adb backups I found the only way to get it working with my adb version was to use the -apk flag with adb backup. Or was it the -system flag.. really should have wrote it down but it was one of the two :-)

I was already using this command to backup files. go to platform-tools/adb.exe path and then run this command. adb backup -f backup.ab -apk com.google.ar.core

Paulovismfr commented 5 years ago

Good night friends. I do not understand much of programming and all these technical terms used here in the forum, but I would like the help of you to help me run ARcore on my Moto G6 play phone that unfortunately is not supported. I did not understand why the developers calibrated the application to the Moto G6 and Moto G6 plus devices to be compatible with ARcore and let the Moto G6 play out of that list. Thanks for the help.

DIGISHORT commented 5 years ago

@faizanalibutt hey how do you extract the logcat from ARCore so I can then put it here.

faizanalibutt commented 5 years ago

@DIGISHORT just connect device to android studio in which arcore is installed and search for (arcore/device_profile/calibration/stuff that's relate to arcore) in logcat. You will find it.

And there is an option namely Create Gist... click on it give credentials and it will extract the logcat for you.

ghost commented 5 years ago

First of all, thank you to everybody who gave a little bit of their knowledge to make this possible. I feel like I'm very close to getting this to work on my Samsung SM-A605FN. I've done every step, backup, restored with the costum_device_profile.textproto and eventually got to the point where a little hand holding a phone shows up on a black screen with a toast saying Failed to create AR session.

Logcat of the crash - https://drive.google.com/open?id=1GnryDFLhyqds4G7J6oPaw5ZOyOwNDttd

In which you can see the error Physical cameras don't match device profile. Camera not found. camera_id=0, cameras count=0.

If somebody could give a hint to what I could possibly be doing wrong, that would be awesome.

Cheers

faizanalibutt commented 5 years ago

I think your device is not matching the requirements thats present in that file. Anyhow just try this once in your phone. Open this link @joaopmarques66

https://github.com/tomthecarrot/arcore-for-all/issues/140

ghost commented 5 years ago

I think your device is not matching the requirements thats present in that file. Anyhow just try this once in your phone. Open this link @joaopmarques66

140

The zip that you provided in the referenced issue is actually the one I'm using, since I could not do a regular backup of my AR Core app.

Is there anything I need to add/edit on the costum_device_profile.textproto? I've tried to play around with the configurations in this file, but I believe the problem is not with the file itself since the error refers cameras count=0.

AlexInTheEcho commented 5 years ago

Hello. I´m totally noob in this forum and adb commands. Since Pokemon Go released AR+ for Android I wanna make my Redmi Note 5 works cause there are a lot of devices supported by Arcore that are similar o lower specs than my phone. Can anyone make a tutorial por dummies like me to use adb commands and make my phone have the Arcore than he deserves? Very thank you

AlexInTheEcho commented 5 years ago

Hello again. I did the backup and I just wanna extract or edit the backup.ab file and it's done (i hope). Please help

faizanalibutt commented 5 years ago

Alex Scroll up and find a link i shared with everyone namely #140 or 140.

You dont need to backup just install arcore app in your phone and then restore backup file i shared in comments in 140 issue. All you have to do is run restore command through adb thats it.

On Sun, Mar 31, 2019, 8:20 PM AlexInTheEcho notifications@github.com wrote:

Hello again. I did the backup and I just wanna extract or edit the backup.ab file and it's done (i hope). Please help

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tomthecarrot/arcore-for-all/issues/139#issuecomment-478350851, or mute the thread https://github.com/notifications/unsubscribe-auth/AZf-ZB6ON50fAIbO64e23jWVWTKeX9uxks5vcNJOgaJpZM4ZhNpE .

AlexInTheEcho commented 5 years ago

Very thank you for the help, but don't work :( I wondering if it's arcore version's fault. I downloaded 1.6 but maybe y I have to instal 1.7 or 1.8? Thank you again

faizanalibutt commented 5 years ago

Try 1.7.

On Sun, Mar 31, 2019, 8:35 PM AlexInTheEcho notifications@github.com wrote:

Very thank you for the help, but don't work :( I wondering if it's arcore version's fault. I downloaded 1.6 but maybe y I have to instal 1.7 or 1.8? Thank you again

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tomthecarrot/arcore-for-all/issues/139#issuecomment-478352057, or mute the thread https://github.com/notifications/unsubscribe-auth/AZf-ZOyjCJbEocVrhOC548KoUepSDSA2ks5vcNXRgaJpZM4ZhNpE .

AlexInTheEcho commented 5 years ago

I will try. Thank you again Just to make my mind clear. The steps are installing de arcore apk. restore your backup, and should works? I don't need to reboot or something? The are more steps?

faizanalibutt commented 5 years ago

Install arcore app v1.7 Restore file i shared using adb restore command. And run app that requires arcore it should work.

On Sun, Mar 31, 2019, 8:48 PM AlexInTheEcho notifications@github.com wrote:

I will try. Thank you again Just to make my mind clear. The steps are installing de arcore apk. restore your backup, and should works? I don't need to reboot or something? The are more steps?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tomthecarrot/arcore-for-all/issues/139#issuecomment-478353228, or mute the thread https://github.com/notifications/unsubscribe-auth/AZf-ZCXEiS6VryLJFvZf5W97PWUdxLL2ks5vcNjbgaJpZM4ZhNpE .

AlexInTheEcho commented 5 years ago

Dont work. I just tried with 1.7 and 1.8 and use Pokemon Go and black screen. I have a Redmi Note 5. I'll keep trying but I don't know what more to do. Everytime I install Arcore do the restore command and work fine, wipe caché in Pokemon Go and when I use AR+ it's frozen. But really, thank you for the help

AlexInTheEcho commented 5 years ago

Can anyone share their backups that are functional? Maybe this way I can make this work. I'd loved use Pokemon Go ar+ and stuff

swiato commented 5 years ago

I also had no luck. I tried to create backup with custom changes and after failure using one from @faizanalibutt. Nothing worked (using samsung galaxy s6). From what I've noticed, after restoring backup to my phone, and making another one from restored apk, that new backup had no changes made to the first one. It looks like that restore had no effect on my apk, even though I saw a message of restoring on my phone. Anyone?

langbeck commented 5 years ago

@faizanalibutt after restoring the backup you provided the profile was loaded:

I native  : calibration_jni.cc:160 Successfully loaded custom v2 device profile from /data/data/com.google.ar.core/files/custom_device_profile.textproto     

But a simple Unity AR tutorial app (that works in emulator) still not working.

E native  : online_calibration_manager.cc:47 OnlineCalibrationManager: Could not open /data/user/0/UniqueName.AR/cache/arcore-online-recalibration for reading
...
W ARCore-AnchorServiceClientFactory: The API key for use with the Google AR service could not be obtained!
...
E native  : status.cc:156 generic::internal: Physical cameras don't match device profile. Camera not found. camera_id=1, cameras count=0
E native  : session_create_implementation_shared.cc:1466 Failed to initilize the data source - -2                                                            
E native  : session_create_implementation_shared.cc:1467 CreateLiveSessionWithMostDependencies returning ArStatusErrorSpace::AR_ERROR_FATAL: .
...
E ArPresto: ArPresto::ArCore session creation failed.
E native  : session_c_api.cc:313 ArConfig_setUpdateMode: session was passed NULL.
E native  : session_c_api.cc:296 ArConfig_setPlaneFindingMode: session was passed NULL.

@inio let me see if I understood things correctly:

What am I missing?

Thanks

EDIT: I'm using a Moto Z2 Play

AlexInTheEcho commented 5 years ago

Well, I give up. Since weeks I've trying to do this with my Redmi Note 5 but can't do this work because I'm totally noob with adb, bash, modify backups and stuff. I can't even understand how this works, but I understand that this post is made for people like developers. I understand, maybe, that in the backup.ab there are a file where I should insert my device profile, or other phone profile? And I can't even know how to do it. Thank you for the knowledge and the help. I hope someday my Redmi Note 5 and other Xiaomi's phone get supported soon

mwvent commented 5 years ago

@space4ardev apkmirror have all the old versions of the apk. The same process for editing the backup works fine on the newer arcore versions though, you can even just install an updated apk over the old one when released as the custom profile gets retained which is great. Do you have a specific need for 1.7?

jorgenascimentoifs commented 5 years ago

Dear mwvent recently released arcore 1.9, which enables the model viewer function, allowing the use of augmented reality on the web. Are you working to make this version available to unsupported androids? this version of arcore is one of the best in a matter of novelty released in the last months. it would help a lot of people to have that access. Thank you in advance for your attention.

kofimokome commented 5 years ago

Hello. Please, mine does not seem to work. I've followed the steps above from @inio and I also followed the steps here I've installed arcore 1.7 I get this output calibration_jni.cc:160 Successfully loaded custom v2 device profile from /data/data/com.google.ar.core/files/custom_device_profile.textproto but I still see a blank screen when I click on the camera icon in Pokemon go. Can someone help me?

I am using Infinix hot s3x, android 8.1

Second Question: Can this also work the the latest arcore ( v1.11 ) ?

mwvent commented 5 years ago

@jorgenascimentoifs - I am just a normal phone user like yourself. Have you tried upgrading to 1.9 and see what happens?

faizanalibutt commented 5 years ago

@kofimokome its probably your phone specs is not near to supportable devices. try to test on flat surface plain surface. like on marble or flat wooden piece. it should work because profile is loaded.

kofimokome commented 5 years ago

Thanks @faizanalibutt I still see a black screen. Is there a way to tweak the custom_device_profile.textproto to match that of my device.

AlexInTheEcho commented 5 years ago

I'm gonna take the chance that this post it's still alive to say please someone that understand the steps can explain how to do it for normal users?

cridus commented 5 years ago

I'm gonna take the chance that this post it's still alive to say please someone that understand the steps can explain how to do it for normal users?

Without root? Sorry but I don't know. If you have root, did you see my guide above?

Eerovil commented 4 years ago

I'm getting the following error:

11-14 12:26:38.288 W/native  (9036): - CAD calibration: File does not have adequate permissions: /data/data/com.google.ar.core/files/custom_device_profile.textproto.

Ive tried the following permissions: -700 -760 -770 -777

Owner user matches the parent directory.

EDIT: I've fixed the issue by setting SELinux to permissive. Chmod 700.