我正在尝试导入compile 'com.squareup.okhttp:logging-interceptor:2.6.0-SNAPSHOT'
正如本教程https://futurestud.io/blog/retrofit-2-log-requests-and-responses/中所示,目前使用的是改进版2.0.0-beta2,但如果只是添加编译行,则会出现错误,我需要做些什么才能使其正常工作?
这是我的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.diegolimon.wedrivetogether"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.github.siyamed:android-shape-imageview:0.9.3@aar'
compile 'com.android.support:design:23.1.0'
compile 'org.osmdroid:osmdroid-android:4.3'
compile 'org.slf4j:slf4j-android:1.7.7'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0-SNAPSHOT'
}
logging-interceptor:2.6.0-snapshot应该包含在改造版2.0.0-beta2中。
答案 0 :(得分:4)
在项目的build.gradle中遗漏了这个。
[Test]
public void TestSavePhoto() {
IList<Model.Photo> photos = repo.GetPhotos();
VegTabUtilityServices.Photo photo = new VegTabUtilityServices.Photo();
VegTabUtil.Model.Photo ph = photos[0];
photo.RowGuid = ph.GetGuid().Value;
photo.Name = ph.Name ?? photo.RowGuid.ToString();
photo.Image = ph.Image;
ISession session = SessionManager.Instance.Session;
PhotoService ps = new PhotoService(session);
using (NHibernate.ITransaction tx = session.BeginTransaction()) {
ps.Save(photo);
tx.Commit();
}
Assert.Greater(photo.RID, 0);
}
[Test]
public void TestPhotoConnection() {
ISession session = SessionManager.Instance.Session;
PhotoService ps = new PhotoService(session);
Photo p;
using (NHibernate.ITransaction tx = session.BeginTransaction()) {
p = ps.Get(6l);
tx.Commit();
}
Assert.NotNull(p);
Assert.NotNull(p.Image);
logger.Debug(String.Format("{0} by {1} pixels", p.Image.Width, p.Image.Height));
}
感谢
答案 1 :(得分:0)
您似乎错过了build.gradle中的repositories
部分
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
存储库部分告诉gradle在哪里查找依赖项。搜索按照列出存储库的顺序进行。