Gradle SYNC耗时超过3个小时。代码似乎永远同步(我曾尝试过重启Android Studio,但无济于事),昨天更新Gradle和Android Studio后,我正在观察这一点。它被卡在Gradle Sync Condfigure构建中,并且要花很长时间才能完成和完成
我尝试了以下技巧和技术:
1) Updated Android Studio to 3.5
2) Tried File-->Settings-->Gradle-->Offline Work
3) Internet connection superfast
4) Not behind any Proxy or VPN
apply plugin: 'com.android.application'
//***********************************************************************************************//
def IOTHUB_DEVICE_CONNECTION_STRING_ENV_VAR_NAME = project.hasProperty('DeviceConnectionString') ? '"'+project.property('DeviceConnectionString')+'"' : '"Define Device Connection"'
def STRING='String'
//***********************************************************************************************//
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.iothub.azure.microsoft.com.androidsample"
minSdkVersion 24
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
each {
//buildTypes.mBuildConfigFields 'DATATYPE','VARIABLE',|"GRADLE VARIABLE|"'
buildConfigField STRING, 'DeviceConnectionString', IOTHUB_DEVICE_CONNECTION_STRING_ENV_VAR_NAME
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude "META-INF/MSFTSIG.SF"
exclude "META-INF/MSFTSIG.RSA"
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'thirdpartynotice.txt'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation ('com.microsoft.azure.sdk.iot:iot-device-client:1.14.2'){
exclude module: 'azure-storage'
}
implementation ('com.microsoft.azure.android:azure-storage-android:2.0.0@aar')
implementation ('org.apache.commons:commons-lang3:3.6')
}
repositories {
mavenCentral()
}