我正在使用 android studio 创建一个 android 应用程序。我想使用以下依赖项“com.google.gson:gson:2.8.5”。我将它添加到我的应用程序的 build.gradle 中,但遇到以下错误:无法解决:com.google.gson:gson:2.8.5
我尝试了以下操作: - 降级依赖项的版本 - 降级 buildToolsVersion 的版本 - 安装 SDK 中可用的所有 Google 包 - 将 mavenCentral() 添加到我的 build.gradle 项目
我的 build.gradle 应用程序:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.topquiz"
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 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation …Run Code Online (Sandbox Code Playgroud) 编译 C++ 文件时收到以下警告:
variables.cpp:10:8: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
int c{2} ;
Run Code Online (Sandbox Code Playgroud)
这是文件:
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std ;
int main()
{
int a = 0 ;
int b(1) ;
int c{2} ;
string myString = "I am a string !" ;
cout << a+b+c << endl ;
cout << myString << endl ;
return EXIT_SUCCESS ;
}
Run Code Online (Sandbox Code Playgroud)
这是命令行:
g++ -std=c++0x -Wall -Wextra -Winit-self -Wold-style-cast -Woverloaded-virtual -Wuninitialized -Wmissing-declarations -Winit-self -ansi -pedantic …Run Code Online (Sandbox Code Playgroud)