Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Michael Gottschalk
@migo
Maybe it would be best to migrate the whole code to Kotlin
Perry
@pfn
yeah, that's probably what I would consider next @migo
Régis Blanc
@regb
hey there, I have been fighting with a weird issue when running processManifest, it seems to complain about a tools:targetApi field coming from one of my dependency, here's the start of the stack trace:
java.lang.RuntimeException: [/home/regb/.android/sbt/exploded-aars/com.google.firebase-firebase-common-19.3.0] /home/regb/.android/sbt/exploded-aars/com.google.firebase-firebase-common-19.3.0/AndroidManifest.xml:32:9-36:35: Error: Invalid instruction 'targetApi', valid instructions are : REMOVE,REPLACE,STRICT
I haven't been able to figure out exactly what it the reason for that, I suspect maybe this is a new feature of the manifest parser and sbt-android might not have this feature? I've tried to read through the code of sbt-android and it seems like it links against the manifmerger library from Android, which would be consistent with the theory if it links against a too-old version?
Any solution to this?
It happened after I bumped a bunch of firebase versions ahead, so I will try to go back in time until I can figure it out, but is there something else that I can do?
Régis Blanc
@regb

Alright so I was able to confirm this, firebase-common in version 19.3.0 has this additional attribute:
tools:targetApi="n"
which is not present in version 19.0.0, and when I override which version to use all seems fine?

Is there some settings somewhere that I can tune to enable the support for tools:targetApi ?

Perry
@pfn
@regb that's interesting, I don't have an answer for it, probably would be to update to a more recent manifestmerger... which would suck right now
Régis Blanc
@regb
alright, thanks @pfn, anyway I can live with the previous version of firebase
Régis Blanc
@regb
By skimming through the messages above, I think I understand that there's not much motivation left to maintain sbt-android up to date (maybe due to the fact that both Scala and Android liked to ignore each other?). but I just wanted to say that I personally find this plugin incredibly useful, I have been developing a few native Android games with Scala, using this plugin, and I have also been working on a large cross-platform game library for Scala (same scala code, multiple backend: scalajs, scalanative, awt, android), and in this project, the sbt-android plugin is critical to support the Android backend.
So thanks for all the hard work anyway!
Perry
@pfn
yeah, it'd be nice to followup with more support, but being limited to scala 2.11 really puts a damper on any motivation to go further
I haven't checked to see if desugar works any better, but I don't think so
Régis Blanc
@regb
I don't actually know much about the internals, and haven't looked too much into the Android/java8/scala 2.12 compatibility, but wouldn't it be possible to use d8 to convert the scala bytecode to something compatible for Android? https://developer.android.com/studio/command-line/d8
Perry
@pfn
@regb yeah, that's desugar, and it doesn't work
at least not when I last tried it 2 years ago
Régis Blanc
@regb
ok :/ that's too bad
doofin
@doofin
@pfn Hi I have create a PR : scala-android/sbt-android#342
Perry
@pfn
@doofin I'll give it a look soon, thanks
VijayPasupula
@VijayPasupula
I am very new to both android & scala, I just installed sbt and created android project using sbt-android plugin. Where can I get documentation on programming android apps using scala. Are there any tutorials for it?
wuque hua
@huawuque_gitlab
Does anyone in the chat room speak Chinese?
I need a technician to crack Android software
i Can pay
Perry
@pfn
@VijayPasupula scala on android is dead, you're probably better off using kotlin
VijayPasupula
@VijayPasupula
@pfn Okay 😥. Thanks for ghe reply.
Victor Ivri
@vivri
@VijayPasupula I had some success using Scala.js + Cordova
VijayPasupula
@VijayPasupula
@vivri cool, I will check it.
doofin
@doofin

@VijayPasupula scala on android is dead, you're probably better off using kotlin

No it's not . scala 2.11 is not that old,and this project still provides peerless experience for functional lovers !

Roberto Leibman
@rleibman
Unfortunately many new libraries are no longer supporting 2.11, 2.13 is already a year old! For production cases that's unacceptable, as you may be missing security patches that you can't get (not to mention not being able to use newer libraries)
doofin
@doofin
Java and android libs is not affected by scala version,will you use lots of scala libs in android?
scala 2.11 works without any problems with android 10
Chenai Nakam
@chenakam
@pfn How to config annotationProcessorOptions.arguments in build.sbt?
i have trying to use RoomDatabase and it works well.
Perry
@pfn
@chenakam I'm not sure atm, it's probably going to be a javacOptions setting
Chenai Nakam
@chenakam
@pfn Do you have an upgrade plan?
I mean at least maybe "com.android.tools.build" % "manifest-merger" % "25.3.0" is needed.
Chenai Nakam
@chenakam
A lot of merging issues of res brought me a lot of trouble. You can also tell me how to start, I will do it myself.
Perry
@pfn
I don't have one right now @chenakam -- I've been out of it for a while and haven't looked at scala stuff at all
mostly it's import new libraries and make sure everything builds :D
Chenai Nakam
@chenakam
[IJ]> compile
[warn] Credentials file /Users/weichou/.bintray/.credentials does not exist
[info] Compiling 33 Scala sources to /Users/weichou/git/me-github/sbt-android/target/scala-2.10/sbt-0.13/classes...
[error] /Users/weichou/git/me-github/sbt-android/src/Keys.scala:11: object AndroidBuilder is not a member of package com.android.builder.core
[error] import com.android.builder.core.AndroidBuilder
[error]        ^
[error] /Users/weichou/git/me-github/sbt-android/src/tasks.scala:23: object BuildConfigGenerator is not a member of package com.android.builder.compiling
[error] import com.android.builder.compiling.{BuildConfigGenerator, ResValueGenerator}
[error]        ^
[error] /Users/weichou/git/me-github/sbt-android/src/aggregates.scala:8: object AndroidBuilder is not a member of package com.android.builder.core
[error] import com.android.builder.core.{AndroidBuilder, DexOptions}
[error]        ^
[error] /Users/weichou/git/me-github/sbt-android/src/aggregates.scala:18: not found: type AndroidBuilder
[error]                                           builder: Logger => AndroidBuilder)
[error]                                                              ^
[error] /Users/weichou/git/me-github/sbt-android/src/Keys.scala:334: not found: type AndroidBuilder
[error]     val builder = SettingKey[Logger => AndroidBuilder]("android-builder", "AndroidBuilder object") in Android
[error]                                        ^
[error] /Users/weichou/git/me-github/sbt-android/src/Dex.scala:6: object AndroidBuilder is not a member of package com.android.builder.core
[error] import com.android.builder.core.AndroidBuilder
[error]        ^
[error] /Users/weichou/git/me-github/sbt-android/src/Dex.scala:212: not found: type AndroidBuilder
[error]       bldr: AndroidBuilder, base: File, bin: File,
[error]             ^
[error] /Users/weichou/git/me-github/sbt-android/src/Dex.scala:54: not found: type AndroidBuilder
[error]   def dex(bldr: AndroidBuilder, dexOpts: Aggregate.Dex, pd: Seq[(File,File)],
[error]                 ^
[error] /Users/weichou/git/me-github/sbt-android/src/Resources.scala:7: object res2 is not a member of package com.android.ide.common
[error] import com.android.ide.common.res2._
[error]                               ^
[error] /Users/weichou/git/me-github/sbt-android/src/tasks.scala:1055: type mismatch;
[error]  found   : java.io.File
[error]  required: Iterable[java.io.File]
[error]         layout.gen, jar.get, processManifest.value, null, resTarget, null)
[error]                         ^
[error] /Users/weichou/git/me-github/sbt-android/src/aggregates.scala:20: not found: type AndroidBuilder
[error]   private[android] case class Aapt(builder: Logger => AndroidBuilder,
[error]                                                       ^
[error] /Users/weichou/git/me-github/sbt-android/src/Resources.scala:17: object Aapt is not a member of package com.android.builder.internal.aapt
[error] import com.android.builder.internal.aapt.{Aapt, AaptPackageConfig}
[error]        ^
[error] /Users/weichou/git/me-github/sbt-android/src/Resources.scala:305: not found: type Aapt
[error]                logger: Logger): Aapt = {
[error]                                 ^
[error] /Users/weichou/git/me-github/sbt-android/src/Resources.scala:4: object AndroidBuilder is not a member of package com.android.builder.core
[error] import com.android.builder.core.{AndroidBuilder, VariantType}
[error]        ^
[error] /Users/weichou/git/me-github/sbt-android/src/Resources.scala:303: not found: type AndroidBuilder
[error]   def makeAapt(bldr: AndroidBuilder, bt: BuildToolInfo, aaptTemp: File,
[error]                      ^
[error] /Users/weichou/git/me-github/sbt-android/src/Resources.scala:348: not found: type AndroidBuilder
[error]   def aapt(bldr: AndroidBuilder, manifest: File, pkg: String,
[error]                  ^
[error] /Users/weichou/git/me-github/sbt-android/src/Resources.scala:19: object OutOfProcessAaptV2 is not a member of package com.android.builder.internal.aapt.v2
[error] import com.android.builder.internal.aapt.v2.OutOfProcessAa
I have successfully upgraded and loaded the sbt project, and I got the following error when compiling.
Chenai Nakam
@chenakam
A large number of APIs are not compatible anymore.
Perry
@pfn
yep, it's pretty sucky @chenakam -- need to dig through and adapt to all the new changes
Maciej Gorywoda
@makingthematrix

Hi all. And Happy New Year.

I'm working at Wire, an encrypted messenger,. Our Android client app is written in Scala. We're slowly migrating it to Kotlin.
I want to make a conference talk about the attempts of writing Scala on Android - how it went, what were the problems, what can still be done in the future.
Especially, @pfn, if you have some time and want to talk about this, I'd like to ask you some questions about your experiences. But everyone else, please ping me if you want to talk. I will be checking this channel every few days, but you can also find me on Twitter, where I live, basically. https://twitter.com/makingthematrix

Maciej Gorywoda
@makingthematrix
Haha :) That Scala 2.13 app is just a small experiment, but it got some attention. It looks like there is some interest in Android in the community after all.
In the near future I will try to investigate more and write some blog posts about Scala + GraalVM + Android + Gluon Mobile. There are many people working hard on each of these components. I guess my contribution can be simply to describe how to put them all together without much pain.
Bjorn Regnell
@bjornregnell
That would be amazing!
Rohan Sircar
@rohan-sircar
Would be great if you could get scalafx working (on graalvm at least if not on android). All my attempts to do so failed.
The javafx api is yucky.
Bjorn Regnell
@bjornregnell
@makingthematrix Would it be possible to implement your scheme in an sbt plugin or is it necessary to use mvn to get your dummy android app to fly?
You mention here https://github.com/makingthematrix/scala_android_dummyapp that there are mvn-plugins that are not available for sbt so my questionb is if it is feasible/possible to port/reimplement those for sbt or if sbt is a dead end for building android apps?
Maciej Gorywoda
@makingthematrix
@rohan-sircar So far it looks like JavaFX is working well for me. But I just started.
@bjornregnell I believe whatever mvn can do, sbt can do better ;) It's certainly not a dead end. It's just that someone needs to write those plugins for sbt. Maybe me in the future.
Maciej Gorywoda
@makingthematrix
But first I want to play a bit with all the usual features of an Android app. If it turns out, for example, that I can't have push notifications, then that's basically a blocker and no sbt plugins will change that.