Ich stecke wegen zwei Kompilierungsfehlern fest, die mich überlegt, dass ich einige Importe fehlt, aber für das Leben kann ich es nicht herausfinden. Ich sollte hinzufügen, dass ich kein Android -Programmierer bin, also habe ich Probleme, die Dokumente zu verstehen. < /P>
Mein Code: < /p>
Code: Select all
package org.godotengine.plugin.android.fitsteps
import android.util.Log
import android.app.Activity
import android.content.Context
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.core.content.ContextCompat
import android.content.pm.PackageManager
import org.godotengine.godot.Godot
import org.godotengine.godot.plugin.GodotPlugin
import org.godotengine.godot.plugin.UsedByGodot
class GodotAndroidPlugin(godot: Godot): GodotPlugin(godot) {
override fun getPluginName() = BuildConfig.GODOT_PLUGIN_NAME
/**
* Example showing how to declare a method that's used by Godot.
*
* Shows a 'Hello World' toast.
*/
@UsedByGodot
fun helloWorld() {
runOnUiThread {
Toast.makeText(activity, "Hello World", Toast.LENGTH_LONG).show()
Log.v(pluginName, "Hello World")
}
}
@UsedByGodot
fun connectToRecordingAPI() {
val localRecordingClient = FitnessLocal.getLocalRecordingClient(this)
// Subscribe to steps data
localRecordingClient.subscribe(LocalDataType.TYPE_STEP_COUNT_DELTA)
.addOnSuccessListener {
Log.i(pluginName, "Successfully subscribed!")
}
.addOnFailureListener { e: Exception ->
Log.w(pluginName, "There was a [url=viewtopic.php?t=20324]problem[/url] subscribing.", e)
}
}
}
< /code>
Die Fehler: < /p>
e: file:///home/emma/Documents/JeuxJam/godot-step-counter/plugin/src/main/java/org/godotengine/plugin/android/fitsteps/GodotAndroidPlugin.kt:34:36 Unresolved reference 'FitnessLocal'.
e: file:///home/emma/Documents/JeuxJam/godot-step-counter/plugin/src/main/java/org/godotengine/plugin/android/fitsteps/GodotAndroidPlugin.kt:36:40 Unresolved reference 'LocalDataType'.
< /code>
Ich habe versucht, herauszufinden, welche Importe ich fehlt. Da LocalDataType Teil von Fitness.data ist, habe ich versucht, Android.fitness.data