Start a new topic

sed error building sample app

sed error building sample app

Hi Andreas,

Ahh ok, I will try that.
Thank you very much for your help!

Hi Roel,

Now everything makes sense! The PhoneGap Android application is not updated to include the latest Wikitude Cordova plugin changes. That's why its having problems resolving this new Wikitude Cordova plugin API.


If you generate the project from the command line and open the created project in Android Studio, it will work.


Best regards,

Andreas


1 person likes this

Hi Andreas,


I use the Phonegap application for Windows, which communicates with the Phonegap application for Android to run the app.


I just tried to run the app on an iPhone using the Phonegap app but it doesn't seem to get the 'app.wikitudePlugin.isDeviceSupported' line

Hi Roel,

I usually use the cordova command line tool to generate the project. Afterwards I open the Xcode (iOS) or AndroidStudio (Android) projects to run the example application.


We had some legal issues with phonegap build when it was introduced. As far as I know they are eliminated, but I still don't use it/haven't tried it recently.


How do you build/start the example app for now?


Best regards,

Andreas

Hi Andreas,

Thank you very much for looking into it!
The plugin doesn't seem to be installed in the build app (apk). The following error appears:
Uncaught module com.wikitude.phonegap.WikitudePlugin.WikitudePlugin not found

Should it work when uploading the zipped project to build.phonegap.com, then build and install the .apk? Or should I build it using cordova commandline or something (never done that before)?

Hi Roel,

We will try to reproduce your issue internally within the next days and let you know any details as soon as we have some.


Is the cordova file plugin installed when you generate the example application? Can you try to debug the Cordova application using Google Chrome to see if there occurs any JS error when launching the example?


Best regards,

Andreas

Hi Andreas,

The 'requestAccess' function is defined in the following files:
platforms\android\assets\www\plugins\com.wikitude.phonegap.WikitudePlugin\www: line 70
platforms\android\platform_www\plugins\com.wikitude.phonegap.WikitudePlugin\www: line 70
platforms\browser\www\plugins\com.wikitude.phonegap.WikitudePlugin\www: line 69
platforms\browser\platform_www\plugins\com.wikitude.phonegap.WikitudePlugin\www: line 69
plugins\com.wikitude.phonegap.WikitudePlugin\www: line 69

The function is called in:
platforms\android\assets\www\js: line 85
platforms\browser\www\js: line 85
www\index.js: line 84

I thought I would give it a shot and try to actually build the project using build.phonegap.com, using the .apk and install it on my android phone to see if that would do anything. In this case I ran into another problem, which is exactly this issue. Maybe it's related to the initial issue?

Hi Roel,

I checked the source files again and WikitudePlugin.js defines a function called `requestAccess` in line 69 and index.js tries to call this function in line 84. Can you confirm that this is the same for you in the final project that you're launching? Maybe some files are not updated correctly on Windows (Staging www folder and www folder).


Best regards,

Andreas

Hi Andreas,

Thank you!
Unfortunately, your project gives me exactly the same error.
I tried downloading the latest version of Phonegap Desktop App for Windows, with no luck. I don't know what else can be the issue.

 

Hi Roel,

We just did that yesterday, so here you can download a .zip package containing a generated Cordova project for Android.

Please let me know if that works for you or in case not, why.


THX

Andreas

Hi Andreas,

Unfortunately I do not have access to an macOS machine.
Is there a way I can download a complete .zip of the entire sample app, without having to use the generation script?

 

Hi Roel,

Can you by any chance give it a try on a macOS system?

We just tried it on macOS for Android and iOS and didn't encounter any such error.


Best regards,

Andreas

Hi Andreas,

I did a fresh download of the .zip on github and installed it again using the app generation script (with disabled sed commands). The same error occurs.

Here is my output of the generation script:
$ ./CreateSampleApp.cmd -d C:/xampp/htdocs/ar_app5 -android true -ios true
*** GENERATING PROJECT ***
Creating a new cordova project.
*** PREPARING SAMPLE CONTENT ***
*** BUILDING SAMPLE APP ***
')droid (cordova version '6.5.0
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: com.wikitude.phonegapsamples
        Name: Plugin_Samples
        Activity: MainActivity
        Android target: android-23
Android project created with cordova-android@5.0.0
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

*** ADDING WIKITUDE PLUGIN ***
Fetching plugin from default GitHub master
Fetching plugin "https://github.com/Wikitude/wikitude-cordova-plugin.git" via git clone
Repository "https://github.com/Wikitude/wikitude-cordova-plugin.git" checked out to git ref "master".
Installing "com.wikitude.phonegap.WikitudePlugin" for android

            Have fun using world's first AR plugin for PhoneGap. Visit http://www.wikitude.com/developer/documentation/phonegap for detailed documentation for the plugin.

            Make sure that you enter your Wikitude SDK trial license key in `WikitudePlugin.js` line 12. If you havent bought a license please visit http://www.wikitude.com/store.

            If you want to contribute to the open source project, please visit us at github, http://github.com/Wikitude

Fetching plugin "cordova-plugin-file" via npm
Installing "cordova-plugin-file" for android
Fetching plugin "cordova-plugin-compat" via npm
Installing "cordova-plugin-compat" for android

The Android Persistent storage location now defaults to "Internal". Please check this plugin's README to see if your application needs any changes in its config.xml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:

      "<preference name="AndroidPersistentFileLocation" value="Compatibility" />"

to config.xml in order for the application to find previously stored files.

** ADDING WIKITUDE SDK LICENSE ***
*** DONE - SUCCESS ***

Hi Roel,

Did you download our Wikitude Cordova example app .zip from GitHub and run the example app generation script without modifying the downloaded Wikitude Cordova plugin? What I'm interested in is: Did you, while removing the sed commands, somehow changed the Wikitude Cordova plugin? The error you mentioned could occur if you use the latest example app but with an older version of our Cordova plugin.


Best regards,

Andreas

Hi Eva,


I'm a step further now.

I disabled the 2 'sed' commands in the generator file. One line for minSDK version and one line for the license key. I manually updated the minSDK version and license keys in the 3 WikitudePlugin.js files.

The app now runs and gets me to the sample overview screen.


I now get this error:

"Error in Success callbackId: WikitudePlugin1256307210 : TypeError: app.wikitudePlugin.requestAccess is not a function"


Can you help me with that?


I'm using jdk1.8.0_121 with cordova (phonegap)


Login or Signup to post a comment