MycroftAI / Mycroft-Android

Android companion app, sends commands from your Android device to your Mycroft system and returns the output as speech or other medium to the Android device.
GNU General Public License v3.0
351 stars 130 forks source link

Android Studio giving Build MyCroft-Failed Errors #105

Open RanjaroInc opened 2 years ago

RanjaroInc commented 2 years ago

Describe the bug When I tried to build an APK, I got these errors in the screenshot linked below

To Reproduce Steps to reproduce the behavior:

  1. I cloned the repo
  2. Waited for everything to load
  3. Tried to build APK
  4. Got error

Expected behavior Build an APK I can run on my device Screenshot 2022-05-25 233636

You may also include screenshots, however screenshots of log files are often difficult to read and parse.

If you are running Mycroft, the Support Skill helps to automate gathering this information. Simply say "Create a support ticket" and the Skill will put together a support package and email it to you.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

Please think carefully about whether you have modified anything in Mycroft's code or configuration files. If so, can you reproduce this on a clean installation of Mycroft? Many "bugs" turn out to be non-standard configuration errors.

jiriks74 commented 2 years ago

I don't develop for Android so IDK if this is the right solution but I got it to build with this:

  1. Add implementation 'com.android.support:multidex:1.0.3' todependenciesinmobile/build.gradle.kts`
dependencies {
    implementation(fileTree("include" to arrayOf("*.jar"), "dir" to "libs"))
    implementation("androidx.appcompat:appcompat:1.3.1")
    implementation("com.google.android.material:material:1.4.0")

    implementation("androidx.legacy:legacy-support-v4:1.0.0")

    // layout deps
    implementation("androidx.cardview:cardview:1.0.0")
    implementation("androidx.recyclerview:recyclerview:1.2.1")

    implementation("androidx.palette:palette:1.0.0")
    implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
    implementation("com.google.firebase:firebase-crashlytics:18.2.4")
    implementation("com.google.firebase:firebase-analytics:20.0.0")

    // Unit test dependencies
    testImplementation("org.mockito:mockito-core:4.0.0")
    testImplementation("org.powermock:powermock-api-mockito:1.7.4")
    testImplementation("org.powermock:powermock-module-junit4-rule-agent:2.0.9")
    testImplementation("org.powermock:powermock-module-junit4-rule:2.0.9")
    testImplementation("org.powermock:powermock-module-junit4:2.0.9")
    testImplementation("junit:junit:4.13.2")
    // Instrumentation dependencies
    androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
    androidTestImplementation("androidx.test.ext:junit:1.1.3")
    androidTestImplementation("androidx.annotation:annotation:1.2.0")

    implementation("com.google.android.gms:play-services-wearable:17.1.0")
    wearApp(project(":wear"))
    implementation(project(":shared"))
    //kotlin
    implementation("org.jetbrains.kotlin:kotlin-stdlib:1.5.31")
    //rxjava,rxandroid
    implementation("io.reactivex.rxjava2:rxjava:2.2.21")
    implementation("io.reactivex.rxjava2:rxandroid:2.1.1")

    implementation("org.java-websocket:Java-WebSocket:1.5.2")

    implementation("androidx.legacy:legacy-support-core-utils:1.0.0")

    implementation ("com.android.support:multidex:1.0.3")
}

  1. Add multiDexEnabled = true to defaultConfig in mobile/build.gradle.kts
android {

    compileSdk = 29
    buildToolsVersion = "31.0.0"
    defaultConfig {
        applicationId = "mycroft.ai"
        minSdk = 19
        targetSdk = 29
        versionCode = project.ext.get("versionCode") as Int
        versionName = project.ext.get("versionName") as String

        testInstrumentationRunner = ("androidx.test.runner.AndroidJUnitRunner")
        multiDexEnabled = true
    }

And it should build