android引用aar资源

时间:2024-04-12 14:30:00

说明:我的计划是引用aar,因此需要配置一点东西

这个项目结构比较简单,需要配置的东西,看起来很清晰,需要的东西,你们自己配置一下就行

1.C:\Users\Windows\Desktop\py\janus-gateway-android-master\build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.1'

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

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'libs'
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

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

  1. C:\Users\Windows\Desktop\py\janus-gateway-android-master\app\build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 32
    buildToolsVersion "33.0.0"
    defaultConfig {
        applicationId "in.minewave.janusvideoroom"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets.main {
        jniLibs.srcDir 'libs'
    }
    namespace 'in.minewave.janusvideoroom'

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:25.3.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    implementation 'com.squareup.okhttp3:okhttp:3.5.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0'
    implementation(name:'libwebrtc', ext:'aar')

}

3.C:\Users\Windows\Desktop\py\janus-gateway-android-master\app\libs\libwebrtc.aar