scaloid
scaloid copied to clipboard
Event gravity does not take parameters or application crashs
Hi
I want create a Layout. Using the converter I get this code:
contentView = new SVerticalLayout {
STextView("Large Text").<<.wrap.gravity(Gravity.CENTER_HORIZONTAL).>>.textAppearance(android.R.attr.textAppearanceLarge)
this += new SLinearLayout {}.visibility(View.VISIBLE).orientation(LinearLayout.HORIZONTAL)
SButton("New Button").<<.wrap.gravity(Gravity.CENTER_HORIZONTAL).>>
SButton("New Button").<<.wrap.gravity(Gravity.CENTER_HORIZONTAL).>>
SButton("New Button").<<.wrap.gravity(Gravity.CENTER_HORIZONTAL).>>
}.<<.fill.>>
but with this code I get this error Int does not take parameters [error] SButton("New Button").<<.wrap.gravity(Gravity.CENTER_HORIZONTAL).>>
If I change it to this
contentView = new SVerticalLayout {
STextView("Large Text") textSize 24.dip
this += new SLinearLayout{}.fill
}
The app crashs.
What is the problem?
Thank you
An error on using this code:
val tmp = new SVerticalLayout { STextView("Large Text") textSize 24.dip try{ this += linearLayout.<<(150 dip,MATCH_PARENT).>>.visibility(View.VISIBLE).orientation(LinearLayout.HORIZONTAL) } catch { case e => error("KOMISCH",e) } }
08-26 09:38:56.520 6836-6836/de.intelligyscience E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: de.intelligyscience, PID: 6836
java.lang.NoSuchMethodError: No virtual method error(Lscala/Function0;Ljava/lang/Throwable;Lorg/scaloid/common/LoggerTag;)V in class Lorg/scaloid/common/package$; or its super classes (declaration of 'org.scaloid.common.package$' appears in /data/app/de.intelligyscience-2/base.apk)
at de.intelligyscience.frontend.QuotationOverview$$anonfun$1$$anon$1.
Sorry this is the correct Exception
08-26 09:41:41.721 6893-6893/de.intelligyscience E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: de.intelligyscience, PID: 6893
java.lang.NoSuchMethodError: No virtual method $less$less(IILscala/Function1;)Lorg/scaloid/common/ViewGroupLayoutParams; in class Lorg/scaloid/common/SLinearLayout; or its super classes (declaration of 'org.scaloid.common.SLinearLayout' appears in /data/app/de.intelligyscience-1/base.apk)
at de.intelligyscience.frontend.QuotationOverview$$anonfun$1$$anon$1.
NoSuchMethodError
frequently caused by misconfiguration of android-sbt-plugin.
Try clean rebuild. If it doesn't help, your build configuration of the plugin have some problem.
Hello, I encountered a similar problem (see stacktrace below). I tried to follow your scaloid example installation instruction for intellij. Do i need to install android-sdk-plugin for sbt in addition? How can i make it work with the sbt plugin of intellij?
Thank you for the very handy framework you are providing!
09-04 09:12:03.258 7173-7173/scaloid.example E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: scaloid.example, PID: 7173
java.lang.NoSuchMethodError: org.scaloid.common.SButton.
I don't know if it is related or may help to find a solution, but i also have a plenty of this kind of warnings:
09-04 09:46:40.268 7621-7621/scaloid.example I/dalvikvm﹕ Could not find method org.scaloid.common.TraitContext$class.startService, referenced from method e_consult.activities.EConsult.startService 09-04 09:46:40.268 7621-7621/scaloid.example W/dalvikvm﹕ VFY: unable to resolve static method 906: Lorg/scaloid/common/TraitContext$class;.startService (Lorg/scaloid/common/TraitContext;Lscala/reflect/ClassTag;Landroid/content/Context;)Landroid/content/ComponentName; 09-04 09:46:40.268 7621-7621/scaloid.example D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0006
Hello again, I seem to have found the source of the problem: the number of methods is exceeding the single dex file size in android. My build console says:
[info] dex method count: 89552
Where the maximum is 65536.
In order to solve this problem, multidex file support must be enabled. I found informations about this option in the official android documentation and android-sdk-plugin for sbt corresponding example.
In short, what you must do is adding the multidex library dependency to your project build.sbt and enable multidex:
libraryDependencies += "com.android.support" % "multidex" % "1.0.0"
dexMulti in Android := true
and add a android:name line to your androidmanifest.xml file:
<application android:label="@string/app_name"
android:name="android.support.multidex.MultiDexApplication">
...
</application>
I hope it helps.
I encountered problems again on other elements. It seems that proguard cache prevents the proper multidex generation, so i commented the line:
proguardCache in Android ++= Seq("org.scaloid")
and for now it seems to work.
Great, thanks!
Although android-sdk-plugin is a great project I think, documentation is not so friendly. It often can be a barrier for newcomers. It would be much better if someone contribute a good tutorial. How about you, @AntoineMorand?
It is a good idea, even if I am no specialist, i could give it a try when I find time.