Я пытаюсь создать недавно созданный проект Android (созданный с использованием flutter create
), но сборка gradle из-за отсутствия зависимостей.
Я попытался установить более новую версию gradle (используя brew install gradle
) и безуспешно пытался изменить ее на версию (5.4.1). Я также читал в нескольких местах, что проблема может быть в конфликте разных версий httpclient
, находящихся в пути к классам, но это не так. Я также попытался добавить зависимость httpclient непосредственно в корневой файл build.gradle, но ошибка остается.
build.grade (root)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
// classpath 'org.apache.httpcomponents:httpclient:4.5.8'
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android/build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.myapp"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
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'
}
Ожидаемый результат: build finished
.
Фактический результат: исключение сборки gradle;
[ +3 ms] * Error running Gradle:
ProcessException: Process "/Users/riccardo/dev/app/android/gradlew" exited abnormally:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.3.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:2.3.0.
> Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
> Could not resolve com.android.tools.build:gradle:2.3.0.
> Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
Как установить эту отсутствующую зависимость? Разве это не должно быть получено, например, из jcenter?