繁体   English   中英

spotify api 模块无法从

[英]spotify api module Cannot resolve symbol from

怎么了?

我尝试了多次使缓存无效并重新启动它,删除了.idea文件夹,只导入了aar文件,并添加了模块......如果有人能帮我解决这个问题,我会很高兴! 非常感谢! 值得一提的是,我也在使用运行良好的 Spotify-auth 库!

我的项目:应用程序文件:

 buildscript {
    ext {
        kotlin_version = '1.5.0'
    }
    repositories {
        google()
        jcenter()
        ext.kotlin_version = '1.4.10'
        maven { url 'https://plugins.gradle.org/m2/' }
        flatDir {
            dirs 'libs'
        }
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.9, 0.99.99]'

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

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

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

我的模块:应用程序文件

plugins {
    id 'com.android.application'
   id 'kotlin-android'

}

android {

    compileSdkVersion 28
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.songout"
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    signingConfigs{
        debug{
            keyAlias 'androiddebugkey'
            keyPassword ''
            storeFile file('C:\\Users\\elton\\.android\\debug-keystore.jks')
            storePassword ''
        }
    }
    buildTypes {
        debug{
            signingConfig signingConfigs.debug
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    //http requests and queue manager library
    implementation 'com.android.volley:volley:1.1.1'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation "androidx.cardview:cardview:1.0.0"
    //This library handles authorization and authentication (please do not update the version and always use 1.1.0)
    implementation 'com.spotify.android:auth:1.1.0'
    // This library handles music playback
    implementation (':spotify-app-remote-release-0.7.0')
} 

感谢所有帮助的家伙,我真的很感激。 经过一番挣扎并一次又一次地重新安装模块后,我得到了解决问题的方法:所以基本上你要做的是:

  • 删除模块、.idea 文件夹,然后运行 Invalidate Caches/Restart;
  • 在重新安装模块之前,请在 Gradle 文件中保留implementation project(':spotify-app-remote')
  • 右键单击应用文件夹并选择新建-> 模块;
  • 选择 import.jar/aar package (如果你通过文件菜单导入模块它永远不会工作不要问我为什么哈哈哈)
  • 将模块名称重命名为:spotify-app-remote并点击完成;

Android Studio 在导入不是来自 gradle 档案的模块时仍然存在一些错误,所以我希望他们将来能更好地了解这一点。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM