我将gradle插件更新为最新版本:com.android.tools.build:gradle:3.0.0-alpha1 发生此错误:
export TERM="dumb"
if [ -e ./gradlew ]; then ./gradlew test;else gradle test;fi
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'Android-app'. Could not
resolve all dependencies for configuration ':classpath'. Could not
find com.android.tools.build:gradle:3.0.0-alpha1. Searched in the
following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
Required by:
Run Code Online (Sandbox Code Playgroud)
当前的circle.yml
dependencies:
pre:
- mkdir -p $ANDROID_HOME"/licenses"
- echo $ANDROID_SDK_LICENSE > $ANDROID_HOME"/licenses/android-sdk-license"
- source environmentSetup.sh && get_android_sdk_25
cache_directories:
- /usr/local/android-sdk-linux
- ~/.android
- ~/.gradle
override:
- ./gradlew dependencies …Run Code Online (Sandbox Code Playgroud) 我已经在我的Android应用程序中完全集成了Firebase Auth,现在我希望客户端使用独特的令牌与我的后端(rails)进行交互.我的问题是它是如何完成的:
谢谢
我使用Android studio的转换工具来转换现有的java测试类.
我收到此错误:
在类文字的左侧只允许使用类
以下是使用的测试用例:
Java的
doAnswer(answerVoid(
(OnDataListListener<List<BEntity>> myCallback) -> myCallback.onSuccess(mList))).when(
mInteractor).performGetBList(any(OnDataListListener.class), anyBoolean());
Run Code Online (Sandbox Code Playgroud)
科特林
doAnswer(answerVoid { listener: OnDataListListener<List<BEntity>> ->
listener.onSuccess(
emptyList())
}).`when`<DragonInteractor>(mInteractor)
.performGetBList(any<OnDataListListener>(OnDataListListener<*>::class.java),
anyBoolean())
Run Code Online (Sandbox Code Playgroud)
那么如何在这种情况下使用通用参数?谢谢.
我正在尝试使用调用API retrofit and rxJava。使用时RxJava 1,下面的代码似乎运行良好,但是一旦我更新RxJava 2到此代码,就会收到此错误:
错误:
不存在类型变量R的实例,因此Observable符合Observable
阿皮
Observable<HttpResult<List<Article>>> getList(@Query("key")String key);
Run Code Online (Sandbox Code Playgroud)
api请求在这里完成,这是我在.map运算符内收到此错误的地方
Observable cache=providers.getList().map(new HttpRsltFunc<List<Article>>());
Run Code Online (Sandbox Code Playgroud)
结果类模型:
private class HttpRsltFunc<T> implements Func1<HttpResult<T>, T> {
@Override
public T call(HttpResult<T> httpResult) {
return httpResult.getData();
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:
导入rx.Observable而不是io.reactivex.Observable代码时,效果很好。
谢谢
我正在迁移到新的匕首android 2.11
所有设置都基于Google蓝图:MVP-Dagger.但我遇到此错误:
错误:(22,57)错误:@Binds方法必须只有一个参数,其类型可分配给返回类型
在这一行:
@ActivityScoped
@Binds abstract PresenterFactory<MainContract.Presenter> providePresenterFactory(MainPresenter presenter);
Run Code Online (Sandbox Code Playgroud)
主持人:
@ActivityScoped
public class MainPresenter extends BasePresenterImpl<MainContract.View>
implements MainContract.Presenter { public MainPresenter(String s) {..
} ... }
Run Code Online (Sandbox Code Playgroud)
有人知道如何解决这个问题吗?谢谢.
我刚刚将Xcode更新到最新版本,项目不再编译。我删除了所有内容并尝试重建 pod,但最终遇到了同样的问题:
[x] /Users/alouanemed/Projects/App-iOS/Pods/_Prebuild/Moya/Sources/RxMoya/MoyaProvider+Rx.swift:2:8:为iOS 10.0编译,但模块“RxSwift”的最低部署目标为iOS 12.0:/Users/alouanemed/Projects/App-iOS/Pods/build/Release-iphoneos/RxSwift/RxSwift.framework/Modules/RxSwift.swiftmodule/arm64-apple-ios.swiftmodule
导入 RxSwift ^
我在活动中使用CardView这套卡片.
在运行应用程序时,我得到的不是预期的cardview:没有高程,没有阴影......
Android 7设备上的结果:
码
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="4dp"
card_view:cardUseCompatPadding="true"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:id="@+id/card_view"
android:padding="10dp"
android:layout_centerHorizontal="true"
card_view:cardBackgroundColor="@color/main_color_grey_800">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="350.0dp"
android:scaleType="centerCrop"
/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:padding="15.0dp"
android:textColor="@android:color/black"
android:textSize="16.0sp"
android:text="@string/LoremText" />
<TextView
android:id="@+id/desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:padding="15.0dp"
android:textColor="@android:color/black"
android:textSize="12.0sp"
android:textAlignment="center"
android:text="@string/LoremText" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="end"
android:orientation="horizontal"
android:paddingTop="10.0dip">
<Button
android:id="@+id/answer_1"
android:layout_width="0px"
android:layout_height="50.0dip"
android:text="@string/Maybe"
android:textColor="@color/white"
android:background="@color/cpb_red"
android:textSize="14sp"
style="@style/DBTheme.Button.Orange"
android:textStyle="bold"
android:layout_weight="1"
tools:ignore="ButtonStyle"
android:visibility="gone" />
<Button
android:id="@+id/answer_2"
style="@style/DBTheme.Button.Orange" …Run Code Online (Sandbox Code Playgroud) android android-layout android-cardview android-recyclerview
我有一个带有 RxDataSources 的表格视图,其中单元格项目有一个删除图标。当单元格出队并单击该删除图标时,所有先前的单击事件都会被触发,从而重复点击。项目单元格:
removeImageView.rx.tap().map { _ in indexPath }
.bind(to: viewModel.onRemoveItem).disposed(by: cellDisposeBag)
Run Code Online (Sandbox Code Playgroud)
单元格视图模型:
let onRemoveItem = PublishSubject<IndexPath>()
Run Code Online (Sandbox Code Playgroud)
单元格和 ViewModel 绑定的视图控制器视图模型:
let vm = ItemViewModel(with: item)
vm.onRemoveItem.bind(to: self.onRemoveItem).disposed(by: self.rx.disposeBag)
return SectionItem.item(viewModel: vm)
Run Code Online (Sandbox Code Playgroud)
视图控制器:
let dataSource = RxTableViewSectionedReloadDataSource<SectionItem>(configureCell: { dataSource, tableView, indexPath, item in
switch item {
case .item(let viewModel):
let cell = (tableView.dequeueReusableCell(withIdentifier: itemtIdentifier, for: indexPath) as? ItemCell)!
cell.bind(to: viewModel, at: indexPath)
return cell
}
}, titleForHeaderInSection: { dataSource, index in
let section = dataSource[index]
return section.title
} )
output?.items
.bind(to: …Run Code Online (Sandbox Code Playgroud) 我有一个Dagger子组件UserComponent,当用户登录应用程序时创建了一个Dagger子组件,下面有我的列表Subcomponents(例如:FriendsComponent,ProfileComponent,HomeComponent ...)。
我想要的是:创建一个名为ProfileComponent(在UserComponent下)的subComponent ,它具有两个Modules ProfileModule和PostsModule:
MainComponent
|
=============|======================
| |
| |
UserComponent WelcomeComponent
|
=========|============
| |
ProfileComponent HomeComponent
|
|
=====================
| |
PostsModule ProfileModule
Run Code Online (Sandbox Code Playgroud)
(我希望这是可读的)
所以ProfileComponent应该包含以下内容:
@UserScope
@Subcomponent(
modules = {PostsModule.class, ProfileModule.class}
)
public interface ProfileComponent {
void inject(PostsFragment postsFragment);
void inject(ProfileActivity profileActivity);
}
Run Code Online (Sandbox Code Playgroud)
这是用户子组件
@UserScope
@Subcomponent(
modules = UserModule.class
)
public interface UserComponent {
HomeComponent plus(HomeModule homeModule);
ProfileComponent plus(PostsModule postsModule);
ProfileComponent plus(ProfileModule profileModule);
}
Run Code Online (Sandbox Code Playgroud)
此处在PostsFragment中完成了注入
protected void …Run Code Online (Sandbox Code Playgroud)