I'm using monaca(onsenui-react) to create cordova app.
After type monaca preview I have checked app on browser like this.
But the index.html wasn't one I expected.
I mean have edited the www/index.html, but it's not loaded on browser.(I don't know what index.html was loaded)
Of course I typed monaca preview after edit www/index.html.
Does anyone can help me?
You need to run monaca transpile to transpile (kind of a compilation) your code into the www folder.
Using monaca preview will use the "webpack.dev.config.js" configuration to generate a compilation to a temporary folder. Using the "transpile" command will use the "webpack.prod.config.js" to compile your code into the www folder.
One more thing: monaca uses a strage combination of folders and package versions (most of them deprecated) to transpile, so I recommend you to do this manually if you are not using the monaca tools (the online paid stuff).
Recently I made a repo with everything already set up (using Onsen UI and React, also Redux - which is easily removable), using the latest version for every npm package (Webpack 2 being the most important, instead of the version 1 used by monaca) and keeping everything in your project folder (in your package.json, like it should be). You can find it here.
Related
The issue is already answered for iOS:
How to embed framework in capacitor plugin for iOS
For Android, I get issues when I add an aar file to the capacitor plugin by creating a new module. After publishing my capacitor plugin via npm and integrating it into an ionic app, the aar library cannot be found anymore.
As done on iOs, we do practically the same thing here. But, using Android Studio and gradle instead of xcode and cocoapods.
Ok, but first things first.
When the command npx #capacitor/cli plugin:generate is issued, what the CLI does is to start a folder containing a cocoa pod for iOs and a gradle plugin for Android. You can see this on the image below.
With the above command issued, there will be a ios and android folders inside you generated plugin folder. If this checks, open you android studio and select the option to open a android studio project, selecting the android folder to fulfil this procedure. You can select this option on the initial screen, like showed on the next image.
With the project opened, if all went well you'll se your android studio showing a screen like this
Now, lets add the plugin files. To do this, right click the android java module and select the "Open Module settings" option, as shown on the next image.
With the following screen opened, we need to add a module here that contains our jar/aar dependencies. To do that, just click on the + sign that is showed above.
On the new module screen, if you scroll down there will be a "Import .JAR/.AAR package", like shown above.
After that, locate you aar package. The result will be the following.
Click finish and the next screen will appear. If not, hit the apply button in this same screen.
Since my module has a dependency, I'll repeat this part of the tutorial.
Next, we need to add our recently added modules as dependencies of the android module. On the same screen, click on the dependencies option and on the plus sign of the "declared dependencies" pane.
The following screen will show. We need to select the 3rd option, since what we did early was adding a module.
Now, lets select our module. Its simple, just mark it and click ok. Since I have to, as said before, I'll check both of them.
If this step went well, you should have now you android module with one more dependency (or two in my case). The image bellow show that.
Hit apply and close this window. Gradle will rebuild your plugin project on the background and after that,since I know kotlin better, I'll convert my project to kotlin. If you wish, this can be done as shown on the next image, but is not mandatory.
With all the above done correctly, you can now import your lib on the TestPlugin.kt (or .java if you didnt use kotlin). For reference, the image bellow show the minimum implementation for my plugin.
In the plugin folder, we are done. Pack it using npm and install on you app.
Next, to the plugin works properly, we need to add its class on the MainActivity of the app that you'll be using it.
Now, to make it work, i'm not 100% sure that this is the correct way to do it, but since it works I do this way. The way I do is to add the plugin modules on the android module of the app via script. I think i am missing something on the gradle plugin implementation, but since it works.....
To do this, access, on your app, the android/settings.gradle file and append this:
Please note that depending on the changes that you do, the settings.gradle file will be rewritten. Do a script to keep the info always there or check it before build.
Thats it, please comment if you know another way to this next step or in any another if there is a better approach. And, if this answer is useful, please thumbs it up, since this implementation, when finished and working, made me cry a little (of happiness, of course).
I have noticed that some of the icons I am using in my cordova project are not displaying on any of my devices. The ones that aren't working seem to have the word ios or android in the icon name (eg: ion-android-list or ion-ios-book-outline). Any ideas why they are just showing up blank? So far any icon I have used with a generic name works fine (eg ion-clock, ion-card). The icon names I am fetching from here: ionicons
I have included this in my index.html file:
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
Apparently the latest version of ionic when building an ionic app using ionic start from CMD loads an outdated icon library v1.5.2 (latest is v2.0.0).
To update the fonts go to the latest ionicons site and download.
Unzip and navigate to the /fonts dir and copy these 4 files to the www/lib/ionic/fonts dir of your app (overwrite).
Do the same for the scss folder and paste to www/lib/ionic/scss/ionicons (overwrite).
Lastly open the ionicons.css file from your extracted zip file /css/ionicicons.css and copy the contents of that file to www/lib/ionic/css/ionicons.css (NOTE: Make sure you edit and only replace the existing font version takes up about the first 1500 - 2000 lines, you will see the comments indicating)
Looks like you're using Ionic, rather than just Cordova.
You could do a partial upgrade to the forthcoming release of Ionic, which includes Ionicons v2:
Download /config/lib/fonts and /scss/ionicons from the latest nightly into the corresponding places in your /www/lib folder
Make sure you have gulp installed locally: npm install gulp
Run ionic setup sass (NOTE: backup your ionic.project file first as this makes some changes)
Replace the files in /www/lib/ionic/css with the new ones in /www/css (requires some renaming).
Fix the relative paths in these copied files: replace ../lib/ionic/fonts with ../fonts
I'm sure there's an easier way, but this worked for me. Someone's made a feature suggestion for always keeping ionicons up to date.
Update:
Animated icons aren't supported with Ionicons v2 yet (ion-spinner will be the replacement). Here's a hack to get them back:
https://github.com/driftyco/ionicons/issues/111#issuecomment-65788526
You need to add display:inline-block to the animation class to work on Android.
For newer versions just use:
<ion-spinner></ion-spinner>
more: ion-spinner
I had the same issue. The easiest way to resolve:
Delete www/ionic/fonts and www/ionic/scss/ionicons directory.
Then run ionic lib update from your project root directory.
i guess it might be about the used version of ionic if it's V5 or if #ionic/angular's version is V5 you need then to use ionicons from version 5 not 4 (they have different names).
Worklight version v6.0.0.20130917-1749,
Dojo 1.9
When I run the preview of an android project when 'provide library resources' is disabled I get the following errors:
"NetworkError: 404 Not Found - http://10.99.8.72:10080/Klappr/apps/services/preview/Klappr/android/1.0/default/main.js"
main.js
"NetworkError: 404 Not Found - http://10.99.8.72:10080/Klappr/apps/services/preview/Klappr/android/1.0/default/typematic.js"
typematic.js
In android this results in a 'scriptError:21'.
I copied all necessary files from the toolkit to my www-folder.
main.js and typematic.js are never required in my js-files.
I don't know why it still searches for it, and not in my www/dojo folder, but instead in the android/1.0/default folder.
Here you see that typematic.js is included. Still I get the error.
I updated Worklight to 6.0.0.1 fix, and still get the error.
Using the Worklight project Fred emailed me I could see the mentioned errors as well.I then:
Removed the "dojo" and "dijit" folders from the www folder
Re-added them from the dojoLib folder in the workspace
Re-built and deployed the application
Previewed via Worklight Console
The errors from before are gone and I could now pass the "splash image" and see the actual app.
I do not think this is related to "Require Library Resources", but to ... something, else.
When looking at the dev tools console, there are now all sort of other errors, but I suspect those are due to dumping the entirety of the dojo and dijit folders into the www folder, and could use some optimization and fixing, but the actual hurdle mentioned in the question is lifted.
http://i.stack.imgur.com/UF9L4.png
I am using phonegap-2.9.0 with file plugin. When I build project for android platform it creates two packages within the src/ folder:
org.apache.cordova.file
org.apache.cordova.filetransfer
I get below errors within these two packages:
1 - org.apache.cordova.file.FileUtils
Method testSaveLocationExists() from the type DirectoryManager is not visible
Method getFreeDiskSpace() from the type DirectoryManager is not visible
Method testFileExists() from the type DirectoryManager is not visible
2 - org.apache.cordova.filetransfer.FileTransfer
import org.apache.cordova.CordovaResourceApi unresolved
import org.apache.cordova.CordovaResourceApi.OpenForReadResult unresolved
Could someone please tell me what I should do to resolve these?
Thanks.
You have two problems.
1) Version of Phonegap is outdated
2) The way to install a plugin is:
-> phonegap plugin add "urlofplugin" or "/path""
-> phonegap platform add android
-> phonegap prepare
-> phonegap build
sometimes the plugin has a different default installation, the files need to change the platform.
Well, I dont know if I can help you, but I had similar problems. When I installed exactly those two plugins I got an error too. A different one, which I dont perticularly remember, something to do with a missing file that I can easily find in the file manager. Anyway, what helped me was:
I updated to a more recent version, if you are able to I advice for it.
After installing the plugins through cordova cmd api (.nodejs command prompt ... you know what I mean) I was forgetting to build in the api itself. It sounds stupid but I was using wp8 and thus using a template for visual studio. The studio gave me the error, the building process (in cmd) also gave errors, but it was fixed by updating to the newer version.
You need to configure you build path and then add library from external source and select the library then it will resolve or u can make copy and paste cordova library .jar file in your lib folder. then it will remove, if not happen then tell me .......
I am not sure if that will work but first uninstall these plugins using phonegap/cordova CLI and than reinstall it in the root of application folder using the CLI only like this:
phonegap local plugin add <required plugin>
This worked for me after reinstallation.
I'm developing a simple plugin to Unity Android, that displays an image from the web.
I've created a Jar using my Java files, and loaded it (in a blank Unity sample application) using AndroidJavaClass.
All worked fine, but then I've wanted to rename my Java package.
From now on - I can't see the image. The plugin doesn't even trying to access it.
I've changed the package name in the Java files, and also in the AndroidManifest.xml and in the CS file that's calling it.
The Jar compiles successfully, the application runs on the device, but... nothing.
I've also created a new application that uses the plugin with his new name, but no success.
What have I done wrong?
Or - what can I do to make it work?
Thanks,
Keren
Why would you code a plug-in to display a web image ?
Just use unity native WWW call, then put the result in a texture.
Look at the unity docs.