Start a new topic
Solved

Paid Licence Key not working on Android

Hello!

Situation: iOS and Android-App working perfect with TRAIL-License-Key. (Of course watermark is shown). I used your "preconfigured" Samples-App for Cordova.


Bought and copied PAID-license-key in all 6 "Wikitude-Plugin.js"-Files.

iOS works great-no watermarks any more!


BUT: Android: It tells me now "License Key Missing"!

Hint: Your File "build.gradle" has NO applicationID inside. Probably that's a problem because the PAID-Key is connected to a AppID and if he doesn't find one...? (I tried to write my applicationID into that file but then I get a other error: Loading AR web view failed: xxxxxxxxxxx.R$string)


What can I try next?

Thank you, Didi


That's the solution!!! Perfect!

Thank you sooooo much Daniel!

I'm very happy!!!

Thumbs up!

Good morning Didi,



I believe I can finally shed some light on this issue; you're just missing a small change. After changing the package in AndroidManifest.xml to your desired application ID, you also need to change the package of the MainActivity class. The following entry


android:name="MainActivity"


will search for the your.app.id.MainActivity class, which does not exist; the package of MainActivity is still com.wikitude.phonegapsamples. Failing to find the class will result in an exception to be raised that can be observed in the logcat window; something like this:


FATAL EXCEPTION: main

Process: your.app.id, PID: 16177

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{your.app.id/your.app.id.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "your.app.id.MainActivity" on path: ...


So you can either change the package of MainActivity, which I'd recommend, or refer to com.wikitude.phonegapsamples.MainActivity explicitly like so:


android:name="com.wikitude.phonegapsamples.MainActivity"


Hoping this will solve the issues you are having.



- Daniel


So, many, many hours of work later I decided now to start from scratch:

My workflow:

- Downloaded "wikitude.cordova-plugin-samples-master" from github (per 16/02/2018)

- Installed (on a new mac): Node 8.9.4, npm 5.6.0 and cordova 8.0.0 (with ios-4.5.4 and android-7.0.0)

- Run "CreateSampleApp.sh"-script

- Copied in my own "world"-folder

- Put in my TRAIL-License

- Opened Android 3.0.1

- Made debug-apk

- Copied apk to Samsung phone

----> All works perfect (of course with TRAIL watermark)

Then:

- Put in my PAID-Keys in all 5(!) "WikitudePlugin.js"-Files (the file in "node_modules does probably not exist any more in Wikitude 7.2.0)

- Changed "AndroidManifest.xml" in platforms/android/app/src/main to my AppID.

-----> After Starting on Phone after immediately a dialogbox is showing "PlugIn Samples angehalten" (in english something like "PlugIn Samples stopped")

I also tried to leave the packagename as it was and changed the "widget id=" to my appID in both config.xml (1x in root-directory, 1x in platforms(android/app/src/main/res/xml) but no success...


So, what can I do now? Where can I change my appID? I am very, very, very desperate because we have paid 2490,- for a license key...


Good morning Didi,



yes, please do so. I believe me looking at your project directly makes sense at this point. I don't really have an explanation in mind as to why this would be happening.



- Daniel


Thank you for your build.gradle-file.

What I tried:

I changed the widget id=... in platforms/android/res/xml/config.xml


..with YOUR build.gradle I get in Android Studio (3.01) the following error:

"Could not find method extractStringFromManifest() for arguments [package] on object of type org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension."


...with MY build.gradle Android Studio builds an apk but when I install it on phone I get the "missing or invalid key error" again.


Should I upload the whole project to an ftp-server so you can have a look inside? (Remember it works perfect with TRAIL-key but with the PAID key only the iOS-version works)

Good morning Didi,



I attached the build.gradle file that resulted from my little test project.


Have you tried changing the config.xml file instead of the AndroidManifest.xml directly?



- Daniel


(10.8 KB)

Thank you for your time, Daniel.

- I changed the packagename in platforms/android/AndroidManifest.xml to my appID, but it doesn't work.

- if I check platforms/android/build.gradle  then my file has no  "applicationId privateHelpers.extractStringFromManifest("package")". If I add this line I get the following error in Android Studio 3.0.1: "Error:Could not find method extractStringFromManifest() for arguments [package] on object of type org.gradle.api.internal.plugins.DefaultExtraPropertiesExtension."


Is there a possibilty to get your build.gradle-file?

Hi,



it seems I was mistaken about the package.json file; the config.xml file apparently holds the applicationId. I created a Cordova project from scratch and found the process to be working as follows:


configx.xml

<widget id="com.abc.def [...]>


goes into


platforms/android/AndroidManifest.xml

<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.abc.def" [...]>


which is read by


platforms/android/build.gradle

defaultConfig {

    [...]

    applicationId privateHelpers.extractStringFromManifest("package")


when building the project.


Depending on the Cordova version used that process might differ somewhat. I was using Cordova 7.0.1, Cordova-Android 6.2.2 and Wikitude Cordova Plugin 7.1.0-3.5.2.


Changing the applicationId in the build.gradle file, as I believe you initially described to have tried, will probably not work due to the Cordova build process re-generating the file upon building. 


If you have, however, built your project using gradle directly after adding the applicationId without re-running Cordova's build process by invoking cordova build android I would have expected that to work.



- Daniel


Thank you for your answer - so I tried again:

1.) Changed "name" in "package.json" to my applicationID (in project root, so in the same hierarchy as "platforms" and "node_modules"-folder)

2.) used again my TRIAL-sdkKey (NOT the PAID one) in all 6 locations as described here under "details": https://www.wikitude.com/external/doc/documentation/latest/phonegap/triallicense.html#where-should-i-enter-the-license-key

3.) made new APK and tested in on my phone: PERFECT, ALL IS FINE (of course there is the wikitude-logo visible and the wordes TRIAL as watermark, but AR functionality works great)

4.) then changed to PAID-sdkkey (again in all 6 locations). No other changes made.

5.) made new APK and tested on my phone: "License key is missing or invalid" (with red "License Key Missing" words as watermark)

???

I can upload both APKs to a ftp-server so you can have a look if that would help.

Good morning Didi,



you are correct about our license keys being bound to specific application IDs. I wouldn't expect you needing to change anything in the build.gradle file. The application ID should be, to my understanding, in the package.json file; like so:


{

    "name": "com.wikitude.phonegapsamples",

    [...]


The error message you are getting is emitted by the loadARchitectWorld function. The most likely cause for this is an incorrect URL input parameter.


Have you tried running the unaltered sample app yet? If not I'd like you to try that and report back with the results.



- Daniel



Login or Signup to post a comment