reuniware / OboeAudioRecorder

This is a sample project that uses Google Oboe Library for recording the MIC input of an Android device and write the recorded data to a .WAV file (works also in background).
24 stars 7 forks source link

'android.enablePrefab' is deprecated. #4

Closed ulysses500 closed 2 years ago

ulysses500 commented 2 years ago

Hi,

I fail to run the OboeAudioRecorder with the most recent Android Studio update.

Could you please tell me what's wrong?

Error message:

Build file '/Users/*****/Documents/OboeAudioRecorder-master/app/build.gradle' line: 1

A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
   > The option 'android.enablePrefab' is deprecated.
     It was removed in version 4.1 of the Android Gradle plugin.
     This property has been replaced by android.buildFeatures.prefab (DSL)

Gradle project:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.5.21"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Gradle module:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.example.oboeaudiorecorder"
        minSdkVersion 23
        targetSdkVersion 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags ""
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
            version "3.18.1"
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}
ulysses500 commented 2 years ago

I've applied "android.buildFeatures.prefab=true" as suggested.

reuniware commented 2 years ago

Sorry I don't have the answer as I don't maintain this project anymore for now. If you find a solution let us know.

lucas-bastosf commented 1 year ago

the answer is in file 'gradle.properties'

change the following line: android.enablePrefab=true

to: android.buildFeatures.prefab=true