Issues with Sencha CMD v5.0.1.231 and beta v5.0.2.250 and phonegap - sencha-touch

It has been awhile since I updated my Sencha CMD (currently running v4.0.4.84). I had successfully updated to Sencha CMD v5.0.1.231, however, while trying to init phonegap
sencha phonegap init com.example.www my-app my-app
I get the following errors in my log:
Sencha Cmd v5.0.1.231
[INF] Creating App
[ERR] The following error occurred while executing this line:
/bin/Sencha/Cmd/5.0.1.231/extensions/cmd-packager/cmd-packager.plugin.xml:131: org.mozilla.javascript.EvaluatorException: Function importClass must be called with a class; had "[JavaPackage java.nio.charset.StandardCharsets]" instead. (anonymous#3)
The same happens with beta v5.0.2.250.
I checked my java version and it is the latest (Java 7 Update 67)

After much tinkering, I have managed to get a clean build with no errors.
Here are my steps:
remove phonegap or cordova: sencha-4.0.4.84 cordova remove
Upgrade to new sencha cmd: sencha upgrade
Update app: sencha app upgrade
Add your build settings to your app.json
```
"builds": {
"web": {
"default": true
},
"native": {
"packager": "cordova",
"cordova": {
"config": {
// Uncomment the line below and add the platforms you wish to build for
//"platforms": "ios android",
"id": "com.company.myapp",
"name": "BaseCordova231"
}
}
}
}
Build your mobile app: sencha app build native
With that, it compiled without any errors, and the app runs in the simulator. Only problem is nothing is showing up.... I guess sencha CMD needs to catch up with my current phonegap v3.5.0-0.21.14.
I think the key problem I had was that I didn't remove cordova/phonegap when Sencha CMD was in v4.0.4.84.
Well, I will take a break from Sencha CMD 5, and use the reliable v4.0.4.84 for now.

I know that you had a sufficient version, so this is not a solution for you.
My app made the same JAVA errors and the solution for me was to upgrade the JDK. I had 1.6.0 which I upgraded to 1.8 and now it's working. Maybe his can help someone.

You need most recent JDK, NOT the JRE as per the Sencha documentation.

I am having the same issue with 5.0.1.231, I don't have a fix or explanation for the error in that version but since multiple versions of Sencha CMD can live side-by-side I put the path to the last version of Sencha CMD I had installed infront of my "sencha" command and was able to continue working.
~/bin/Sencha/Cmd/5.0.0.160/sencha phonegap init com.example.www my-app my-app

After some tinkering with my project I was able to get Sencha Cmd to work. I ended up making 2 changes:
1) Fixed syntax errors in my javascript files:
C1000: Rhino Parse Warning (Trailing comma is not legal in an ECMA-262 object initializer => })
2) Deleted the Sencha Cmd repo folder located at: /Users//bin/Sencha/Cmd/repo Sencha Cmd will rebuild this if it is missing.
I'm not sure which one of those changes actually corrected my issue, but those are the only 2 things I did in between it working and not working. And when I say "it" I mean specifically the sencha app build native command

Related

React native Fabric autolink error with react 60.0 and above

I have upgraded to my app to react-native 60.4 which support Autolinking all packages so that you dont have to manually go about setting things up and thus lowers the chances of error.
The problem is most of the packages have still not gotten compatible with this process and henceforth the app completely breaks.
my error is with https://github.com/corymsmith/react-native-fabric
referring to an issue on the repo for the same -> https://github.com/corymsmith/react-native-fabric/issues/225, which still remains unanswered.
I started giving it a try by forking the repo and understanding the auto link process given by react native.
In the package.json of the node_module package i replaced
"rnpm": {
"android": {
"packageInstance": "new FabricPackage()"
}
},
with file in the package root react-native.config.js
module.exports = {
dependencies: {
'react-native-fabric': {
platforms: {
android: {
"packageImportPath": "import com.smixx.fabric.FabricPackage;",
"packageInstance": "new FabricPackage()"
}
}
}
}
};
I also updated the build gradle to 3.4.1 from 3.1.0
My react native app is able to now find the package.
But when i call the package in my react component i get NoClassDefFoundError, which means that class is not found.
Anybody else gave this a try and have a solution please let me know.
Try to unlink with react-native unlink and then re run your code again.
Putting it here from the above comment to make it more clear:
Ok i got this to work by changing the forked repo -> (adding a react-native.config.js in the root of the package with with auto discovery and link configurations), but i think the only scalable solution i see right now is to degrade to RN ^59.0 as not a lot of packages have auto link config changes. So will wait for RN 60.4 to mature and then upgrade to it in about a month. In addition to this fabric is currently migrating to firebase and plans to complete by year end. This mean that anyways the sdk integration is going to be obsolete and hence this package too.
Also this issue is majorly related to react-native-fabric and not RN itself.

React Native Android fails: error 3

Hope you could help me here:
I'm currently building an app which I created through CRNA and then ejected. I get the ios version right on but I'm currently struggling a lot with the android version.
When running react-native run-android all I can get is the following error:
Error type 3
Error: Activity class {com.myapp/com.myapp.MainActivity} does not exist.
I've checked app/build.gradle, app/src/main/AndroidManifest.xml, app/src/main/java/com/myapp/MainActivity.java and app/src/main/java/com/myapp/MainActivity.java for name errors on package. I've tried moving from com.myapp to com.mebius.myapp and com aswell.
Seems this comes from the only plugin I'm using. I'm keeping on the investigation
Any hints?
There are 3 possible reasons for the android app build fails to make
1. You need to define sdk path in android/local.properties
if local.properties doesn't place then make a file names with that
add
sdk.dir = home/user/AndroidApp/local/Sdk
You can match with their system path..
2. Your genymotion or avd must enable with the android studio
3. You must have to go with the following command
npm start
in new terminal .
Please go through with it.
Thanks
Actually I had a problem with my gradle config which look like:
include ':react-native-sensors'
project(':react-native-sensors').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sensors/android')
rootProject.name = 'accelapp'
I needed to add: include ':app'
I don't know if it's due to the process of ejecting from CRNA or if it's due to react-native link react-native-sensors though.
EDIT After some investigation, I couldn't reproduce this issue. This leads me to say it was a faulty copy/paste...

PhoneGap / iOS7 / XCode 5 / Mavericks: compiles but doesn't really work

I have used Phonegap several times but since the upgrade to Mavericks / Xcode5 everything has changed.
If I try to create a helloworld project, everything looks good: it compiles and launches the simulator or installs the app on my phone. The problem is if I try to add any Phonegap functionality, the it just won't work.
UPDATE: this is how I'm creating the project:
cordova create helloworld
cordova platform add ios
I have tried directly opening helloworld.xcodeproj in Xcode, using the "cordova run ios", "cordova prepare", "cordova build" commands but none of them seems to make any difference (some of these create and copy a lot of files, but there is no difference regarding the access to "device" variable)
The only way of debugging I have managed to use is to show alerts and try/catch blocks like this:
try {
alert(device);
// var text = '';
// var i = 0;
// for (var attribute in window) {
// text = text + '\n' + attribute;
// i++;
// }
// alert("total " + i + " keys: " + text);
} catch (err) {
alert(err);
}
Trying to read from "device" variable results in the following:
The text on this error suggests that one should use the following command
phonegap plugin add thePlugin
That indeed works: it adds the desired feature on the config.xml file, but the problem persits, so it does not look like an issue related to permissions. The same thing occurs when installing and trying to use other plugins, such as accelerometer or notifications.
I really liked Phonegap because it made things easier, but now it seems the opposite. One optoin is to use an older version of Phonegap and/or Xcode, but that's not what I'm looking for.
So, what is my configuration?
Mavericks 10.9.1
Xcode 5.0.2 (5A3005)
Phonegap / cordova 3.3.0
iOS 7.0.4 (iPhone 5) --> or the emulator
Any clues?
Thanks
I finally managed to solve this issue.
The solution is simple, yet it was difficult to detect.
Every time you add a plugin using the following command: cordova plugin add thePlugin you then need to run the cordova prepare command again. This is tricky, because if you take a look at the code after adding the plugin there is some setup/changes made. But these changes aren't enough, so cordova prepare might first seem redundant, but solves the issue.
So:
create the project
add as many plugins as you might use
start developing either:
(a) directly on the generated YOURAPP.xcodeproj file, and NEVER run
the cordova prepare commmand again, otherwise you will delete all your
changes
(b) work on the "general" www folder of your project and then run cordova prepare everytime you need to create a new version. Note:
you'll need to close the xcodeproj file in order to see any changes
I tend to think that alternative "(a)" should be the optimal, just make sure you don't overwrite your files or keep your files properly versioned

IBM Worklight - AppCenter app missing Plugin 'com.ibm.mobile.InstallerPlugin'

I'm having the same problem as this user. I've built the IBM Worklight AppCenter client application using eclipse (AppCenter -> Run As -> Build All Environments) opened it in xcode (iphone -> Run As -> Xcode project) and run the app in the iphone emulator via xcode.
After I enter my Worklight server credentials in the app (username, password, server, port, context) a "Loading" message is displayed and the app ceases functioning.
I've debugged through the app's javascript and traced the problem to the app trying to execute a call to a Cordova native plugin:
cordova.exec(pSuccessCallback, // Success callback from the plugin
function(e){
console.log("Error connecting to server [code, msg, status] = "
+ e.errorCode + ", "
+ e.errorMsg + ", "
+ e.httpCode);
pFailureCallback(e);
},
'com.ibm.mobile.InstallerPlugin', // Tell cordova to run "com.ibm.mobile.InstallerPlugin" Plugin
'updateConnection', // Tell plugin, which action we want to perform
[pUsername, pPassword, pServerURL]); // Passing list of args to the plugin
This error message is displayed in xcode: IBMAppCenter[2315:70b] ERROR: Method 'updateConnection:' not defined in Plugin 'com.ibm.mobile.InstallerPlugin'
The native libraries implementing this plugin are in their expected locations but don't appear to seen by the application - IBMAppCenter/apps/AppCenter/iphone/native/appCenterLib:
Debug-iphoneos/libAppCenterInstallerLib.a
Release-iphoneos/libAppCenterInstallerLib.a
Debug-iphonesimulator/libAppCenterInstallerLib.a
Release-iphonesimulator/libAppCenterInstallerLib.a
Are there any additional steps required to include the native libraries in the application?
Any help would be greatly appreciated.
The method "updateConnection" is defined in the InstallerPlugin. I think it is simply the first method to be called of the InstallerPlugin, hence the problem might be that you accidentally removed the installer plugin.
The directory IBMAppCenter/apps/AppCenter/iphone/native/appCenterLib must contain the different versions of libAppCenterInstallerLib.a:
Debug-iphoneos/libAppCenterInstallerLib.a
Release-iphoneos/libAppCenterInstallerLib.a
Debug-iphonesimulator/libAppCenterInstallerLib.a
Release-iphonesimulator/libAppCenterInstallerLib.a
The method updateConnection is contained in libAppCenterInstallerLib.a.
If those libs are missing, you can copy them from the original installation directory of IBM Worklight.
Please never delete the native directories of IBMAppCenter/apps/AppCenter before regenerating the iphone or Android environment. If you delete the native directories, you delete those required libraries, and then the AppCenter client is not functional.
I managed to fix this by upgrading to Worklight 6.1.
In recent versions of Cordova, the Plugin method signature has changed.
Verify this by extracting the libAppCenterInstallerlib.a with:
ar -x libAppCenterInstallerlib.a
then run:
nm IBMAppCenterPlugin.o
look for the initInfo or updateConnection methods. If they have :withDict in the method signature, then this is deprecated in recent versions of Cordova.
Using the AppCenter project from Worklight 6.1, I no longer see this issue.

Cannot package a debug application (cannot create .apk)

I am following this tutorial to create .apk file:
http://docs.sencha.com/touch/2-0/#!/guide/native_android
On step#4 when I run the following command nothing happens:
sencha package run packager.json
Absolutely nothing happens. There is no success/error message shown and command prompt is ready to take the next command.
Here is my config file for debugging:
{
"applicationName":"myApp",
"applicationId":"com.techleadz.myApp",
"iconName":"resources/icons/Icon~ipad_myApp.png",
"versionString":"1.0",
"outputPath":"build/",
"inputPath":"build/native/",
"configuration":"Debug",
"platform":"AndroidEmulator",
"deviceType":"Universal",
"certificatePath":"C:/Users/Administrator/.android/debug.keystore",
"certificateAlias":"androiddebugkey",
"sdkPath":"C:/android-sdk-windows/",
"orientations": [
"portrait",
"landscapeLeft",
"landscapeRight",
"portraitUpsideDown"
]
}
What I am doing wrong?
you have not specified a certificate password or an android list target you must have installed the disk image for the list target that you are trying to include and target must be atleast 7
Are you using Ubuntu ?
if so there is some problem in sencha tools for packaging for native.
Thanks