How to create android project from weex - weex

I can't add platform from weex, only from weexpack
drew#drew-Aspire-E1-571G ~/Work/Weex/awesome-project $ weexpack platform add android
Error: Current working directory is not a weexpack project
and I cannot compile weex to android project
.

If you use weex-toolkit, you should create some files and dirs by yourself, including:
dirs:
web
platforms
plugins
files:
android.config.json
ios.config.json
config.xml
Edit config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.alibaba.weex" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp1</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
In the current version, you can also use weex create to create weexpack project.
And of course, a starter kit maybe also helpful for you: https://github.com/elemefe/weex-vue-starter-kit

Related

IONIC 4 : Image from api loading failed on android release apk

I'm using ionic 4,and using cordova-plugin-advanced-http for reading data from api. when I'm trying to read images from API on debug mode,everything is working fine,but when I make released apk images are not displaying and I'm facing with 404 error. and the other hand I tried to install and configure cordova-plugin-whitelist as like as below but it's still not working.
config.xml
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<access origin="https://*.jomsave.com" />
<allow-navigation href="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
<access origin="content:///*" />
<access origin="file:///*" />
index.html
<meta http-equiv=“Content-Security-Policy” content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-eval' 'unsafe-inline'; media-src *">
this issue is only appear in android and only when I'm building release apk and ios version is working fine
Try removing and then adding cordova-plugin-whitelist :
cordova plugin remove cordova-plugin-whitelist
cordova plugin add cordova-plugin-whitelist

Phonegap build email plugin not recognized

I built an app that utilizes the phonegap build plugin for composing emails with attachments. The app is working well on iOS devices but email is not working on Android devices. Here is part of my config.xml:
<preference name="disable-cursor" value="true" />
<preference name="orientation" value="default" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="false" />
<preference name="permissions" value="none"/>
<gap:platform name="android" />
<preference name="loadUrlTimeoutValue" value="700000" />
<gap:config-file platform="android" parent="/manifest"><application android:hardwareAccelerated="false"/></gap:config-file>
<icon src="icon.png" hover="true"/>
<icon src="icon.png" default="true" width="57" height="57"/>
<icon src="icons/android/mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
<icon src="icons/android/hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
<icon src="icons/android/xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
<icon src="icons/android/xxhdpi.png" gap:platform="android" gap:qualifier="xxhdpi" />
<gap:splash src="splash.png" width="270" height="480" />
<gap:splash src="default-568h#2x.png" gap:platform="ios" width="640" height="1136"/>
<splash src="splash.png" />
<feature name="http://api.phonegap.com/1.0/file" />
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/contacts"/>
<plugin name="com.jcjee.plugins.emailcomposer" spec="1.4.6" source="pgb" />
<plugin name="cordova-plugin-file" spec="3.0.0" source="pgb"/>
and my javascript that calls the email composer:
window.plugins.emailComposer.showEmailComposerWithCallback(null, email_subjectdef, "", email_default, [], [], true, [compatibleAttachment, compatibleAttachment2]);
I am currently trying the jcjee plugin but also tried the deappplant plugin.
The error I receive on the device is:
"cannot read property 'emailcomposer' of undefined.
Thanks for your help!
I was able to determine what the error was an the email plugin is working fine on Android. I had been using an iframe to display a PDF file. Apparently Android 4.4.2 does not like iframes, at least not in a Phonegap Build project. Removing the iframe solved my problem.

Blackberry config.xml is different in Worklight build methodologies

I'm building our BB10 environment in Worklight using two different ways.
1- Through Eclipse IDE:
The config.xml in the native folder which has been generated after building the environment contains all the feature that we need in our project.
<?xml version='1.0' encoding='utf-8'?>
<widget id="MobileBanking" version="1.0.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" rim:backButton="exit">
<name>Mobile Bank</name>
<author email="support#company.com">company</author>
<description>
Mobile Bank
</description>
<license href="http://opensource.org/licenses/alphabetical">
</license>
<access subdomains="true" uri="file:///store/home" />
<access subdomains="true" uri="file:///SDCard" />
<!-- start_worklight_host_server do not change this line-->
<access subdomains="true" uri="https://mobile-qa.company.ca" />
<!-- end_worklight_host_server do not change this line-->
<access subdomains="true" uri="tel://*"/>
<access subdomains="true" uri="http://google.com"/>
<access subdomains="true" uri="http://maps.googleapis.com"/>
<access subdomains="true" uri="http://googleapis.com"/>
<access subdomains="true" uri="http://maps.gstatic.com"/>
<access subdomains="true" uri="http://fonts.gstatic.com"/>
<access subdomains="true" uri="http://csi.gstatic.com"/>
<access subdomains="true" uri="https://www.company.com/*" />
<!-- <access subdomains="true" uri="*" /> -->
<icon src="icon.png" />
<rim:splash src="splash-1024x600.png" />
<rim:splash src="splash-600x1024.png" />
<rim:splash src="splash-1280x768.png" />
<rim:splash src="splash-768x1280.png" />
<content src="webresources/skinLoader.html" />
<rim:permissions>
<rim:permit>read_device_identifying_information</rim:permit>
<rim:permit>access_shared</rim:permit>
<rim:permit>read_geolocation</rim:permit>
<rim:permit>access_pimdomain_contacts</rim:permit>
<rim:permit>access_pimdomain_messages</rim:permit>
<rim:permit>access_location_services</rim:permit>
</rim:permissions>
<preference name="HideKeyboardFormAccessoryBar" value="true"/>
<preference name="Orientation" value="portrait"/>
<preference name="ChildBrowser" value="disable"/>
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="WebSecurity" value="enabled" />
<feature id="blackberry.invoke" name="blackberry.invoke" value="blackberry.invoke" />
<feature id="blackberry.app" name="blackberry.app" value="blackberry.app" />
<feature id="com.blackberry.utils" name="com.blackberry.utils" />
<feature id="com.blackberry.pim.lib" name="com.blackberry.pim.lib" />
<feature id="Battery" name="Battery" value="Battery" />
<feature id="Camera" name="Camera" value="Camera" />
<feature id="Contacts" name="Contacts" value="Contacts" />
<feature id="Device" name="Device" value="Device" />
<feature id="Accelerometer" name="Accelerometer" value="Accelerometer" />
<feature id="Compass" name="Compass" value="Compass" />
<feature id="Notification" name="Notification" value="Notification" />
<feature id="org.apache.cordova.file" name="File" value="File" />
<feature id="FileTransfer" name="FileTransfer" value="FileTransfer" />
<feature id="Geolocation" name="Geolocation" value="Geolocation" />
<feature id="Media" name="Media" value="Media" />
<feature id="Capture" name="media-capture" value="Capture" />
<feature id="NetworkStatus" name="NetworkStatus" value="NetworkStatus" />
<feature id="SplashScreen" name="SplashScreen" value="SplashScreen" />
<feature id="Vibration" name="Vibration" value="Vibration" />
</widget>
2- When I use Ant Worklight Builder, the generated native folder for BB10 contains the following config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="MobileBank" version="1.0.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" rim:backButton="exit">
<name>MobileBank</name>
<author email="support#company.com">company</author>
<description>
MobileBanking
</description>
<license href="http://opensource.org/licenses/alphabetical">
</license>
<access subdomains="true" origin="file:///store/home" />
<access subdomains="true" origin="file:///SDCard" />
<!-- start_worklight_host_server do not change this line-->
<access subdomains="true" origin="https://mobile-qa.company.ca" />
<!-- end_worklight_host_server do not change this line-->
<access subdomains="true" origin="*" />
<icon src="icon.png" />
<rim:splash src="splash-1024x600.png" />
<rim:splash src="splash-600x1024.png" />
<rim:splash src="splash-1280x768.png" />
<rim:splash src="splash-768x1280.png" />
<content src="webresources/skinLoader.html" />
<rim:permissions>
<rim:permit>read_device_identifying_information</rim:permit>
<rim:permit>access_shared</rim:permit>
<rim:permit>read_geolocation</rim:permit>
<rim:permit>access_pimdomain_contacts</rim:permit>
</rim:permissions>
</widget>
All the feature tags disappear using Ant builder.
Worklight Ant task version 6.2.0.01.20150329-1923
WebWorks SDK version 2.2.0.15.
I tried Windows and Mac. got same result.
Thank you.
See this blog post: https://developer.ibm.com/mobilefirstplatform/2015/03/05/ootb-support-blackberry-webworks-2-2/
I've created an application with the BlackBerry 10 environment two times: using The WebWorks 1.0 SDK and the WebWorks 2.2 SDK. The difference in config.xml is due to the SDK used.
The Worklight builder will create the first config.xml if your environment variable for WEBWORKS_HOME is pointing to WebWorks 1.0.
The Worklight builder will create the second config.xml if your environment variable for WEBWORKS_HOME is pointing to WebWorks 2.2.
This means that your Studio and Ant .jar file are not of the same version Worklight.
Get the latest iFix from IBM Fix Central; to get the Ant .jar I believe that you will need to extract the Server installation to get it.

cordova config.xml whats valid and whats not? trying to get navigator.notification.alert() to work, failing

I have been trying to sort this out for a while, and I have been trying to piece one together via google searches.. But I am recently noticing that most of the docs I come or have come across are for older versions of cordova/phonegap. I am using I 3.x or whatever the latest one is. Either way, my config.xml I feel is a mess. Another thing I noticed is I seem to have two config.xml's one is in the www folder, one is right at the same level as the www folder, the copy below is the one at the same level as the www folder which seems to be the one that listens to changes but Im not sure if there is a conflict there either.
I also found a copy of phonegap.js from the examples.. which I think is based on 1.7.0 and not my current version of phonegap/cordova. All in all I am trying to figure this all out so I can use things like the camera, so I can change things like the title of a alert box to go from a long path and file name then my message.
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.domain.coffee" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
<name>title of app (wont put here)</name>
<description>
my long lengthy description
</description>
<author email="team#domain.com" href="http://www.domain.com">
domain development team
</author>
<content src="index.html" />
<feature name="LocalStorage">
<param name="ios-package" value="CDVLocalStorage" />
</feature>
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
<access origin="*" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="UIWebViewBounce" value="true" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="EnableLocation" value="true" />
<preference name="EnableViewportScale" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="OpenAllWhitelistURLsInWebView" value="false" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<plugins>
<plugin name="Device" value="CDVDevice" />
<plugin name="Logger" value="CDVLogger" />
<plugin name="Compass" value="CDVLocation" />
<plugin name="Accelerometer" value="CDVAccelerometer" />
<plugin name="Camera" value="CDVCamera" />
<plugin name="NetworkStatus" value="CDVConnection" />
<plugin name="Contacts" value="CDVContacts" />
<plugin name="Debug Console" value="CDVDebugConsole" />
<plugin name="Echo" value="CDVEcho" />
<plugin name="File" value="CDVFile" />
<plugin name="FileTransfer" value="CDVFileTransfer" />
<plugin name="Geolocation" value="CDVLocation" />
<plugin name="Media" value="CDVSound" />
<plugin name="Capture" value="CDVCapture" />
<plugin name="SplashScreen" value="CDVSplashScreen" />
<plugin name="Battery" value="CDVBattery" />
<plugin name="Globalization" value="CDVGlobalization" />
<plugin name="InAppBrowser" value="CDVInAppBrowser" />
<plugin name="org.apache.cordova.facebook.Connect" value="FacebookConnectPlugin" />
</plugins>
</widget>
note I have followed this most recently:
http://docs.phonegap.com/en/3.0.0/cordova_notification_notification.md.html#notification.alert
also an example of my message attempts would be:
navigator.notification.alert("my fancy message", "my title", "OK");

PhoneGap App Crashes while installing in my iPhone..

I have created the app using Phonegap 2.7.0 version.I have build the .ipa file and installed it.App crashed, But using Phonegap 1.6.0 Version it's working well. No crashes on installation.Please help me. this is my config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
-->
<widget>
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="DisallowOverscroll" value="false" />
<preference name="EnableLocation" value="false" /><!-- DEPRECATED -->
<preference name="EnableViewportScale" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value=".25" />
<preference name="HideKeyboardFormAccessoryBar" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="KeyboardShrinksView" value="false" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="TopActivityIndicator" value="gray" />
<content src="index.html" />
<plugins>
<plugin name="Device" value="CDVDevice" />
<plugin name="Logger" value="CDVLogger" />
<plugin name="Compass" value="CDVLocation" />
<plugin name="Accelerometer" value="CDVAccelerometer" />
<plugin name="Camera" value="CDVCamera" />
<plugin name="NetworkStatus" value="CDVConnection" />
<plugin name="Contacts" value="CDVContacts" />
<plugin name="Echo" value="CDVEcho" />
<plugin name="File" value="CDVFile" />
<plugin name="FileTransfer" value="CDVFileTransfer" />
<plugin name="Geolocation" value="CDVLocation" />
<plugin name="Notification" value="CDVNotification" />
<plugin name="Media" value="CDVSound" />
<plugin name="Capture" value="CDVCapture" />
<plugin name="SplashScreen" value="CDVSplashScreen" />
<plugin name="Battery" value="CDVBattery" />
<plugin name="Globalization" value="CDVGlobalization" />
<plugin name="InAppBrowser" value="CDVInAppBrowser" />
</plugins>
<access origin="*" />
</widget>
Can you please provide some code of your config.xml file.I have faced some similar problem.I forgot to write new version of the phonegap into the config.xml file and build using the new version and in config.xml file there is old version. so its make conflict for application and was crashed.
Note:
There are many upgradation are there for the phonegap 2.7.0 and sometimes however it will create issues if you use go straight with 2.7.0 from 1.6.0.
It may cause issues some times if you don't have any errors in your code.Hope this will help.
Ok.Good.
Put this into your widget tag and try to rebuild the application.
<preference name="phonegap-version" value="2.7.0" />