Closed charleschege closed 3 years ago
Thanks for trying it out!
What are the contents of BuildTask.kt
?
Thanks for trying it out!
What are the contents of
BuildTask.kt
?
Where is this file supposed to be located? I can't find it
Judging from the error output, it should be at /home/x43/projects/KeAir/gen/android/ke-air/buildSrc/src/main/kotlin/BuildTask.kt
.
I was doing a file search that did not produce any results but I can see the file exits in that directory. Here are the contents of BuildTask.kt
package wild-machine.x43.ke-air
import com.android.build.gradle.*
import java.io.File
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.logging.LogLevel
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
open class BuildTask : DefaultTask() {
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
var rootDirRel: File? = null
@Input
var target: String? = null
@Input
var release: Boolean? = null
@TaskAction
fun build() {
val rootDirRel = rootDirRel
if (rootDirRel == null) {
throw GradleException("rootDirRel cannot be null")
}
val target = target
if (target == null) {
throw GradleException("target cannot be null")
}
val release = release
if (release == null) {
throw GradleException("release cannot be null")
}
project.exec {
workingDir(File(project.getProjectDir(), rootDirRel.getPath()))
executable("cargo")
args(listOf("android", "build"))
if (project.logger.isEnabled(LogLevel.DEBUG)) {
args("-vv")
} else if (project.logger.isEnabled(LogLevel.INFO)) {
args("-v")
}
if (release) {
args("--release")
}
args("${target}")
}.assertNormalExitValue()
}
}
I was able to replicate this issue - it only happens when I use a Domain
with a -
character, so example.com
works, but some-example.com
fails. Hyphens are not valid in java/kotlin package names, so if you want to get this working you should change your domain to something that doesn't contain hyphens.
In the meantime, I'll try to create a PR that includes hyphens in the list of disallowed characters in domain names so that something like that wouldn't happen again.
Thanks! That solved my issue
I am now able to fully build and run for android. However, I have tried the winit and wgpu templates and they start well but crash immediately. Has anyone successful run the templates on android or are these known issues.
The cargo android run
logs
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
Success
Starting: Intent { cmp=wildmachine.x43.keair.ke_air/android.app.NativeActivity }
--------- beginning of crash
--------- beginning of system
--------- beginning of main
Have you tried running it again? There is currently a known issue with rust library not being attached to the apk in the same run - more described in #13. There is an open MR #18 that might fix this in the near future. But I don't know if that's a case for you as well. If not, please run adb logcat | grep -i "Cargo"
and provide the logs.
I am also not a kotlin expert but re-running cargo android run solves the issue. Thanks for the help
The demos are working perfectly, the android window is stable. A year ago, I tried cargo-ndk and cargo-apk and they didn't work. Cargo-mobile is much better. Great work
After the new Linux support was merged, I installed cargo mobile and I have tried to run it with
cargo android run
on a connected device. I have chosen thewinit
project template, everything downloads fine but the build fails when gradle is trying to compile the java dependencies.What could be the issue?