Android not working with shared project

I was wondering what the currently approach is to use SharedProject with an Android Cooper project? Currently, I am unable to add the reference to the SharedProject like I can do for the iOS project.

What could be the problem? Are there any good examples of projects which use SharedProject, and a iOS and Android app project?

I think it would be beneficial to have an example project on like Github which works like https://blogs.remobjects.com/2017/08/16/strategies-for-cross-platform-code-sharing-with-elements/ or https://blogs.remobjects.com/2017/08/03/elements-case-study-curacao-weather/

define “unable”? what fails? I used Shared projects with Android just last week when I recorded our Fire video: Video: Introduction to Fire | RemObjects Software.

If you told me what’s wrong, I could take a stab and making a guess…

Several samples (such as the cross-platform Calculator) do use shared projects, but ]here’s not really much to show specific to Shared projects. it’s just that the files are in the shared project instead of the main one…

Well, I have my SharedProject and my understanding I would need to add as a reference to my Android app project but it’s not getting listed when I choose “Add reference” in the context menu. After watching your video again it looks like I need to drag it on the Android project.

Shouldn’t it get listed in the Add reference dialog too?

The Add References dialog currently doesn’t do Project references, shared or regular; drag and drop id the way to add those. I’ll look at maybe adding them there in the future, as well.

Thanks, logged as bugs://82342

Dragging it is working for me.

Now I am getting when building/running my Android project:

E: dex: com.android.dx.cf.code.SimException: at stack depth 0, expected type RemObjects.Elements.RTL.CharArrayExtensions but found char[]
E: dex: com.android.dx.cf.code.SimException: at stack depth 0, expected type RemObjects.Elements.RTL.CharExtensions but found int

How would I be able to debug this where could be the potential cause? I have mailed the most recent code base of my project to your email address

What build are you using — this should be fixed in latest?

2893 on the Mac. The special build yo made for me is for Water and there is a “RemObjects Elements - Full Zip Distro - develop-20190409-231732 - 0c713ad - 10.0.0.2394.zip” but not sure how to apply this to my current Fire version :innocent: Do I need to install Mono (to get gacutil.exe?) and run install.sh?

Setting up the External Compiler for use with Fire explains it.

1 Like

I have installed the special build and this giving this error:

/usr/local/bin/mono /Users/x/Development/Compilers/10.0.0.2394/EBuild.exe /Users/x/Development/Projects/config-app/MatrixSenseConfigApps.sln --logger:fire --configuration:Debug --skip-projects:{9112E243-1B95-481E-B520-7C629564284F} --setting:9112E243-1B95-481E-B520-7C629564284F,Simulator=True --setting:9112E243-1B95-481E-B520-7C629564284F,Device=False --debug --statistics --verbosity:diagnostic --xml:/var/folders/q_/g_m12x9x4gqg6r6zxjjfw8j80000gn/T/MatrixSenseConfigApps.fire.xml --build --setting:TreatFixableErrorsAsWarnings=True
RemObjects EBuild. An open source build engine for Elements and beyond.
Copyright RemObjects Software 2016-2019. All Rights Reserved. Created by marc hoffman.
Version 10.0.0.2394 (develop) built on talax, 20190409-231732. Commit 0c713ad.

It’s failing for Android at:

                     dex> processing org/me/matrixsenseandroid/SensorService$4.class...
                     dex> processing org/me/matrixsenseandroid/User.class...
E:                   dex: com.android.dx.cf.code.SimException: at stack depth 0, expected type RemObjects.Elements.RTL.CharArrayExtensions but found char[]
E:                   dex: com.android.dx.cf.code.SimException: at stack depth 0, expected type RemObjects.Elements.RTL.CharExtensions but found int
                     dex> 2 errors; aborting

Looks like it’s something wrong in my SharedProject?

Hmm, that build should have the fix. I’ll send you a new one now, can you try that one?

No, this has nothing to do with shared projects; it was a compiler bug/regression triggered by a recent change in Elements RTL, last week.

—marc

1 Like

Sure, happy to try any new build :slight_smile:

already up.

if this still fails, this is a new/different bug that just looks similar.

Can you also check in the log file to make the the elements.jar file thats referenced is the one from the newly installed build, not the oe from inside Fire? (should be, by default, if you use the external compiler but jic).

thanx!

1 Like

Downloading!

I can confirm the fixes in this build resolved the enum issue I had earlier this week :smiley:

1 Like

Sorry, I have installed it and the error still occurs. I have mailed you and Carlo the compiler output and the latest code base which causing the error.

thanx, I’ll have a look and log.

E: The error(s) above might be due to the Android tool chain not supporting JDK9 yet. Downgrade to JDK8 to fix.

Let met try downgrade. Can’t remember when I installed JDK8

That’s a separate error though?

do you still get

E: dex: com.android.dx.cf.code.SimException: at stack depth 0, expected type RemObjects.Elements.RTL.CharArrayExtensions but found char
E: dex: com.android.dx.cf.code.SimException: at stack depth 0, expected type RemObjects.Elements.RTL.CharExtensions but found int

too?

After downgrading the JDK version and cleaning the build it seems to compile successfully with the latest compiler version.

Running /Users/x/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r /Users/x/Development/Projects/x/matrix/version-3/config-app/MatrixSenseAndroid/Bin/Debug/org.me.matrixsenseandroid.apk
adb: failed to install /Users/x/Development/Projects/x/matrix/version-3/config-app/MatrixSenseAndroid/Bin/Debug/org.me.matrixsenseandroid.apk: cmd: Can’t find service: package

Hmm, if I run the application I am seeing this in the debugger:

~> Started
~> Process MatrixSenseAndroid started
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0002 ()
~> Message: java.lang.ClassNotFoundException: android.widget.ViewStub
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0002 ()
~> Message: java.lang.ClassNotFoundException: Didn't find class "android.widget.ViewStub" on path: DexPathList[[zip file "/data/app/org.me.matrixsenseandroid-eeE_nM1rZ4pPN14BSmyOUg==/base.apk"],nativeLibraryDirectories=[/data/app/org.me.matrixsenseandroid-eeE_nM1rZ4pPN14BSmyOUg==/lib/x86, /system/lib, /vendor/lib]]
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0002 ()
~> Message: java.lang.ClassNotFoundException: android.webkit.ViewStub
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0002 ()
~> Message: java.lang.ClassNotFoundException: Didn't find class "android.webkit.ViewStub" on path: DexPathList[[zip file "/data/app/org.me.matrixsenseandroid-eeE_nM1rZ4pPN14BSmyOUg==/base.apk"],nativeLibraryDirectories=[/data/app/org.me.matrixsenseandroid-eeE_nM1rZ4pPN14BSmyOUg==/lib/x86, /system/lib, /vendor/lib]]
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0002 ()
~> Message: java.lang.ClassNotFoundException: android.app.ViewStub
~> Ignored exception of type java.lang.ClassNotFoundException on thread 0002 ()
~> Message: java.lang.ClassNotFoundException: Didn't find class "android.app.ViewStub" on path: DexPathList[[zip file "/data/app/org.me.matrixsenseandroid-eeE_nM1rZ4pPN14BSmyOUg==/base.apk"],nativeLibraryDirectories=[/data/app/org.me.matrixsenseandroid-eeE_nM1rZ4pPN14BSmyOUg==/lib/x86, /system/lib, /vendor/lib]]

Now I am wondering what android.webkit.ViewStub is supposed to do. I am not aware of using any WebKit bits