Debugging Codename One app on Android Studio - codenameone

I need to debug my CN1 app on Android. That's why I successfully followed the instructions given in this Codename One tutorial (I copied and updated the gradle files dependencies content as explained).
I am a little bit confused now with the updated sources part.
There is a portion we didn’t get into with the video, copying updated sources directly without sending a build. This is possible if you turn on the new Android Java 8 support. At this point you should be able to remove the libs jar file which contains your compiled data and place your source code directly into the native project for debugging on the device.
If I change things in the native implementation file and if I launch the debug process it seems to work. But do I have to remove the userClasses.jar file from libs directory ? When is this jar file being called actually ?
Furthermore can I also make changes to the CN1 code from Android Studio (eg changes in Main Class) or these need a proper build process on the servers ?
UPDATE November 22nd 2016
In my experience the first time you want to debug your app in Android you need to copy paste your source files AND the userClasses.jar (in libs folder). When you update ONLY the native implementation files you can run a debug without sending a build. But if you change something in the CN1 code it won't be reflected in Android as long as you don't update the userClasses.jar (seems logical since Android does not know anything about CN1).
Any piece of information appreciated,
Cheers,

The build server doesn't have access to your code, just the jar with bytecode/data files and the user jar is "almost" that jar.
We run some bytecode processing such as retrolambda and other things so it isn't exactly what you compiled when you built the project.
If you copy and paste your source directory into the project you will need to remove that jar so you won't see duplicate classes. You will also need to enable Android Studios Java 8 language support to get that to work.

Related

WebkitGtk application is not loading file URL

I am building a kiosk application using webkitgtk on the raspberry pi 4.
This application will not be connected to the internet and all the html,css, javascript for the UI are all located on the local filesystem.
I am using buildroot to setup the Linux system, starting with the pi 4 defconfig provided in buildroot.
I have enabled all the packages needed to get webkitgtk running.
Also, the kiosk application has been tested on my desktop, using the same software stack and it works
However, when i try to launch the application on the raspberry pi, a blank page pops up. I have played around with the WebKitWebSettings object associated with my WebKitWebView by enabling local file access. It still shows up a blank screen.
Also included in my pi4 application bundle is a simple gtk3+ application. This launches successfully!
I will really appreciate some pointers as to why this is happening as i have sort of reached a dead end
UPDATE
I enabled the MiniBrowser app that comes with the Webkitgtk package.
Entering the local url, The page does not load. It only gives me a message at the top saying "Successfully downloaded".
It seems to be treating my input as a download
UPDATE 2
After some more experimenting, i was finally able to get webkitgtk working on the pi 4.
The problem seems to originate from using the webkit_web_view_load_uri() api.
It does not seem to recognize my html document as a web page.
I got around it using the webkit_web_view_load_html() call. This included some hacks by first reading in the contents of the html doc into a character buffer, and passing it to webkit_web_view_load_html().
You also have to provide a base path to this function call to be able to resolve all the urls (scripts, css, images etc) in your html document.
Another problem i haven't been able to work around is, SVG images are not loading in webkitgtk. I have used jpg formats and they work. I suspect this my be due to a configuration switch in building webkigtk
It's hard for me to figure out what might be happening without having access to your environment and settings. My gut feeling is that pages are showing blank because perhaps some shared libraries are missing. You can check that with:
$ ldd WebKitBuild/GTK/Release/bin/MiniBrowser
I am using buildroot to setup the Linux system, starting with the pi 4 defconfig provided in buildroot.
There's a buildroot repository for building WPE for RPi. WPE (WebPlatform for Embeded) is like WebKitGTK but doesn't depend on GTK toolkit. Another important difference is that WPE runs natively on Wayland.
If you're interested in having a webapp embedded in a browser running in a device with limited capabilities, WPE is a better choice than WebKitGTK. The buildroot repo for building WPE for RPi is here:
https://github.com/WebPlatformForEmbedded/buildroot
There's is also this very interesting step-by-step guide on how to build WPE for RPi3:
https://samdecrock.medium.com/building-wpe-webkit-for-raspberry-pi-3-cdbd7b5cb362
I'm not sure whether the buildroot recipe would work for RPi4. It seems to work for all previous versions, so you might be stepping in new land if you try to build WPE on RPi4.
If you have an RPi3 available I'd try to build WPE for RPi3 first, and make sure that works. Then try for RPi4.

How to open *.jdk file?

I have file which has extension JDK.
Can anyone please tell What does it mean.
How to open it.
I have tried note pad it was showing data but with special character.
I need formatted data.
The Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (javadoc) and other tools needed in Java development.
When you install a JDK it extracts a folder to a path and it's named as jdk{version}.
I'm guessing that you're using a mac because JDK's look like jdk{version}.jdk in macs. This can be found at /Library/Java/JavaVirtualMachines. However, you can open this just like another folder. But if that's not the case, you can hold control and click
the file with the extension .jdk and select show package contents.
As far as using it, you usually set it up as your JDK in your IDE.

Does every form and/or console application require installation?

Let's say that I have created a form or a console application. This form application's only dependency is .NET Framework (not a 3rd library) and application doesn't have any kind of requirements. What it does is to take a file and transforms to something else.
Does this application need to be installed? Can I just copy .exe file that is under \bin folder and share it?
First, you need to make sure that Copy Local is set to true for all the references of your start up project. Setting copy local to true will make sure that the DLLs get copied to the output directory. Then, build the solution and copy all the files from your output directory to any machine where you want to run the application. The application should work, as long as it has the appropriate .NET framework installed.
Here's a link about how to set copy local to true: http://msdn.microsoft.com/en-us/library/t1zz5y8c%28v=vs.100%29.aspx
There are 2 Ways to Do This... I just did this 20 Min Ago :)
Method 1 : Right Click on Your Project, Publish, Choose Location For
The installer. This installer can be copied onto other machines, installed and run
Method 2 : Your bin/release folder will contain .exe files which need to be copied and Installed, i prefer the 1st method. It avoids missing important / Needed Files for execution
Just a Side Note. Make Sure the Output Type Is of Console Type (Right Click on project... Output type...), Some windows applications give Problems when Publishing and Installing them due to the frameworks that might be missing

Sencha Desktop Packager executable

I have built a desktop version of my extjs app using Sencha desktop packager trial. It has created an output folder with a lot of dll files and an .exe file. The executable runs ok when i open it from within this folder but once i move the .exe outside it no longer runs. So it seems it is dependent on the other files generated along with it.
Am i doing something wrong here or is it supposed to be like this? Is it possible to get a single executable that will run on client machine?
Secondly after installation, is it possible to do automatic updates (or at least prompt for an update) based on version number?
Thanks,
You should use something like InnoSetup in order to automate the installation of the whole App directory on a foreign computer.

Issue Signing xap file in post build event on TFS Build

We have a silverlight(5) project, the source in TFS (2010) and Continuous Integration build has been setup and working fine. However, we are now at the stage where we are trying to release it to some users to get them using it and give feedback. I've set up the code so that it checks for updates and if there are any it downloads the latest xap file. However this requires the xap file to be signed. No problem when doing this from our dev machines, but when it comes to the automated build it fails, with the message
Xap packaging failed. Cannot locate the signing tool SignTool.exe.
I've tried numerous things to get the signtool to be recoginised and can't. However, we don't actually need this on the CI build, so I've then tried a second tack which is to make the postbuild event conditional on being run in VisualStudio. Followed various suggestions here on SO but can't gett them to work.
The post build event is
if "$(BuildingInsideVisualStudio)" == "true" (
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe" sign /f "$(SolutionDir)castle.pfx" "$(TargetDir)Castle.xap"
copy "$(TargetDir)Castle.xap" "$(SolutionDir)Castle.Web\ClientBin"
)
still no joy. Have tried multiple variations of this, but keep getting the same message from the automated build.
So can anyone help with either a) getting the signing tool to be recoginised on the build server or b) getting the automated build to skip the postbuild event?
Found the problem in the end...
I had been putting in place some features so the app would download and install the latest xap file. This requires it to be signed. As this wasn't working I followed some instructions on signing a xap file, not realising that one of the other developers here had put in place the code I described above in the post build event.
I had mistakenly thought that this was created as a result of me checking the 'Sign The Xap File' check box.
So first issue was that other developer had not shared his pfx file with us to add to our certificate stores.
Second, and main issue, was that we then had two attempts at signing going on. The one via the check box and the one via the post build event. I removed the check box and it worked fine.
The issue with the check box is that it expects the SignTool.exe to be in a particular location. On our development boxes with full VS it is where it is looking for it, but on the build server it wasn't. Think it may also have something to do with 64bit machines.
By using only the build event (once you have the correct certificates installed) you can specify explicitly the location that the signtool is going to be, and if necessary install the windows sdk to that location.
This is the top result in Google for this error so updating it with my steps to resolve.
The above didnt work for me but performing the steps below should fix it.
Install the Windows 8.1 SDK on the build server (Windows 2008 R2 for me)
Adding the Windows SDK BIN directory (that contains signtool.exe, on my server) to the Environment PATH variable - e.g. c:\program files (x86)\Windows Kits\8.1\bin - note: Do not add quotes around this
Restart all the Visual Studio Team Foundation services in services.msc after you add the file path to the PATH variable as it needs to reload these before building

Resources