我正在尝试构建项目,但这是我得到的错误消息.
Error:(32, 13) Failed to resolve: com.firebase:firebase-jobdispatcher:0.5.0
Show in File
Show in Project Structure dialog
Error:Failed to resolve: com.android.databinding:compiler:2.2.3
Open File
Show in Project Structure dialog
Run Code Online (Sandbox Code Playgroud)
这是app模块的构建文件: -
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
applicationId "com.example.android.sunshine"
minSdkVersion 10
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}
dataBinding.enabled = true
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:preference-v7:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
compile …Run Code Online (Sandbox Code Playgroud) android firebase mobile-development firebase-realtime-database firebase-storage
我正试图在HttpURLConnection课堂的帮助下打开一个连接.
我已经尝试过这段代码来处理一个URL,但在看到Logs时,我发现它无法获取重定向的URL.在示例代码中,您将看到要获取URL,我正在使用while循环,因此它记录了相同的URL.我迫切希望找到更好的解决问题的方法.我希望问题很清楚.
这是我正在使用的示例代码: -
Log.d(TAG,"URL received : --- >"+downloadURL);
URL url=new URL(downloadURL);
HttpURLConnection httpURLConnection=(HttpURLConnection) url.openConnection();
httpURLConnection.setDoInput(true);
httpURLConnection.setInstanceFollowRedirects(true);
httpURLConnection.connect();
Log.d(TAG,httpURLConnection.getResponseMessage()+" Append with "+httpURLConnection.getResponseCode());
while(httpURLConnection.getResponseCode()==HttpURLConnection.HTTP_MOVED_PERM)
{
httpURLConnection.getInputStream();
URL url1=httpURLConnection.getURL();
Log.d(TAG,"Redirected URL = "+url1);
}
InputStream inptStream=httpURLConnection.getInputStream();
Run Code Online (Sandbox Code Playgroud)
这是logcat的输出: -
03-08 13:28:38.814 22597-23668/abhirojpanwar.tablayout D/AsyncImageDownloader: Redirected URL = https://unsplash.com/photos/65sru5g6xHk/download
03-08 13:28:38.814 22597-23668/abhirojpanwar.tablayout D/AsyncImageDownloader: Redirected URL = https://unsplash.com/photos/65sru5g6xHk/download
03-08 13:28:38.814 22597-23668/abhirojpanwar.tablayout D/AsyncImageDownloader: Redirected URL = https://unsplash.com/photos/65sru5g6xHk/download
03-08 13:28:38.814 22597-23668/abhirojpanwar.tablayout D/AsyncImageDownloader: Redirected URL = https://unsplash.com/photos/65sru5g6xHk/download
03-08 13:28:38.814 22597-23668/abhirojpanwar.tablayout D/AsyncImageDownloader: Redirected URL = https://unsplash.com/photos/65sru5g6xHk/download …Run Code Online (Sandbox Code Playgroud) java android network-programming httpurlconnection androidhttpclient