Error: Invalid key or package name

+2 votes
asked Mar 1, 2019 by jemogoll (260 points)
retagged Mar 7, 2019 by jemogoll

Hi, I keep getting the "Invalid key or package name even after verifying several times that the key is correct and that the package name is exactly the same that I used for the licence on the easyar page.

I have also re-create and delete keys in order to make my app work but it just keeps giving me the same error.

The app works when I turn the network connection off, but my app NEEDS to have internet connection, so it's not a solution.

What i've been doing is building the app on Unity, then exporting it to gradle and then attaching it to my Android app as a library, but I don't know if I have to enter the key in some place after building it from unity, because in unity I've already entered the key.

In the docs (https://www.easyar.com/doc/EasyAR%20SDK/Getting%20Started/2.0/Setting-up-EasyAR-Android-SDK.html) I see that when you are working on android studio, you need to enter the following method: 

protected void onCreate() {
    Engine.initialize(this, key);
}
but I don't know if in my case I have to do it too and where to put it.
Thanks.

2 Answers

0 votes
answered Mar 7, 2019 by jemogoll (260 points)
 
Best answer
I managed to solve this.

What was happening, was that the BundleId / PackageName have to match the AndroidApp BundleId / PackageName, and not the UnityExport ones.

So I just put the Unity project a different BundleId and then I updated my AndroidApp bundleId to match the EasyAR platform one and it worked!

My AndroidApp is made with Ionic, if someone wans to integrate EasyAR with Ionic, take a look at this plugin:

https://github.com/yasirkula/UnityIonicIntegration

Everything works for EasyAR too, but you have to take a look at this here:

https://github.com/yasirkula/UnityIonicIntegration/issues/48
0 votes
answered Mar 2, 2019 by zhnagjian (11,130 points)
Hello,

You need to check if the name of the Sample you imported in Android Studio is the same as the Package name in the EasyAR official website.

Thank you!
commented Mar 4, 2019 by jemogoll (260 points)
When I export the project from unity to Android Studio, it just creates a folder with the name of the app that I'm creating, I just checked the package name in the AndroidManifest.xml file and is exactly the same as the one on the EasyAR page.
What I understand of your comment is that the folder (exported from unity) should have the same name as the package name (in EasyAR page).
I just did that and it keeps giving me the same error.
This only happens when I export that from unity to Android Studio, because when I build the .apk from Unity it works perfectly, but I don't need the .apk from unity.
Can you please help me or be more specific?
Thanks.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...