当前位置: 首页 > 知识库问答 >
问题:

Android Studio中的等级同步问题

冀嘉木
2023-03-14

这是我的build.gradle文件

buildscript {

    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

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

而且,我的gradle-wrapper.properties文件也如下所示:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

共有1个答案

公孙阳文
2023-03-14

试试看:

在Build.Gradle(项目)中:

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

buildscript {
    ext.kotlin_version = '1.3.61'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        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
}

在Build.Gradle(模块)中:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.example.mytestapplication"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.1.0'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.core:core:1.3.0-alpha02'
    implementation 'androidx.mediarouter:mediarouter:1.1.0'
}
 类似资料:
  • 驴你看,我要添加截取到我的应用程序添加这行代码com.mcxioke。截取:库aar:1.0.0建立。gradle文件 我也试着添加改装。但它给出了相同类型的错误:未能解决:bla bla bla。 所以我认为在我的情况下gradle不能同步任何其他库不同于com.android....... 我也尝试将这行代码添加到我的build.gradle。但是什么都没有改变 请指教 编辑:添加注释后生成。

  • 我安装了Android Studio 3.4,在同步gradle时遇到了这个问题。我到处都找不到解决问题的办法。 以下是我收到的错误: “无法解析:com.android。支持:appcompat-v7:28.0.0在项目结构对话框中显示受影响的模块:app” “无法解析:com.android.support。约束:约束布局:1.1.3在项目结构对话框中显示受影响的模块:应用程序” “无法解析:

  • 问题内容: 据我所知,并已替换为更好的并发机制。那么,对于实现同步队列,您会选择哪种更好的替代方法呢? 它们究竟在什么意义上“更好”? 编辑 :这(“实现同步队列”)是一个采访问题。可接受的答案不能使用BlockingQueue或其他队列实现。但是,它可能使用其他同步构造,例如CountDownLatch。我没有允许和禁止的类的详尽列表- 请您注意。 问题答案: 已被Lock类方法和Conditi

  • 问题内容: 我面临pthread的同步问题。threadWaitFunction1,是线程等待函数。我希望行号。仅在243-246完成后才执行247 。但我感到奇怪的是,有时它会在243-246完成之前直接跳到247。 请帮我。 提前致谢。 创建并调用上述线程的线程是: 如果我使用pthread_mutex_lock保护整个函数,但仍然存在相同的问题。 如何确保有序执行?有人可以帮忙吗? 编辑:n