草庐IT

kotlin_module

全部标签

android - Dagger @Module 中的 "injects"应该放什么?

引导用户,尝试在这里了解Dagger的一些好处。假设我有以下内容MyActivity.java---------------publicclassMyActivity{@InjectMyImplicitClassmyImplicitClass;@Inject@Named("foo")MyExplicitClassmyNamedExplicitClass;...}MyImplicitClass.java------------publicclassMyImplicitClass{@InjectMyImplicitClass(MyExplicitClassmyExplicitClass){

安卓工作室 : "Import Module" changes structure of existing library

我想将现有的第3方库项目作为模块导入到我自己的项目中。我使用AndroidStudio0.6.1的“New->Module->ImportExistingProject”向导,它完成了工作但对该库的源代码进行了大量修改(重新排列源文件夹,修改build.gradle等。).有没有一种方法可以按原样导入库项目,而导入插件不会引入任何更改? 最佳答案 看起来没有办法避免导入插件所做的修改。它拥有的所有设置是三个与依赖管理相关的复选框。我试图取消选中所有这些,但它仍然改变了我的项目结构。我设法手动添加现有的库项目:1)将库的目录复制到我的

android studio : Error : Module version com. android.support :support-v13:13. 0.0 依赖库但本身不是库

我尝试将此库(https://github.com/daimajia/AndroidImageSlider)添加到我的项目中。我在我的gradle文件中添加了编译库,但出现错误:applyplugin:'com.android.application'android{compileSdkVersion20buildToolsVersion'20.0.0'defaultConfig{applicationId"com.pp.myapp"minSdkVersion16targetSdkVersion20versionCode1versionName"1.0"}buildTypes{rele

javascript - react native : Native modules return nothing

我是ReactNative的新手,我想调用native模块以从Android获取一些字符串。我这样写代码:@ReactMethodpublicStringgetToken(){Stringtoken="";//thentakethetokenLog.i("getToken:",token);returntoken;}然后在js中使用。vartokenString=thismodule.getToken();但是,当我在js中调用该方法时。我可以在logcat中看到正确的日志“I/getToken:palapalapala”,但js无法获取任何内容。那么,正确的代码是什么?

Android Kotlin Mvp 类委托(delegate)

所以我有以下场景:classNowActivity:AppCompatActivity(),NowScreen,NowDelegatebyNowDelegateImpl(){onCreate(...){presenter.attachView(this)}有什么方法可以将某些NowScreen方法的实现委托(delegate)给NowDelegate,这样我就可以在演示者内部执行以下操作:view.callSomeFunc()其中callSomeFund()是在NowDelegate中实现的。有什么办法可以完成这样的事情吗?问题是我正在使用MVP,它将View附加到演示者。但是一些Vi

java - 无法使用 Kotlin 在项目中设置 Realm

我正在尝试使用Realm在Kotlin中构建一个测试项目。这是我的模型:openclassBook:RealmObject(){//Standardgetters&settersgeneratedbyyourIDE…@PrimaryKeyopenvarid:Long=0openvartitle=""openvardescription=""openvarauthor=""openvarimageUrl=""}这是我得到的异常:FATALEXCEPTION:mainProcess:app.androidhive.info.realm,PID:18782java.lang.RuntimeE

android - 在Kotlin项目中应用Realm插件导致编译报错

我正在尝试将Realm添加到Android项目中,我已经添加了项目级别的classpath依赖项,但是将应用插件:'realm-android'我模块的build.gradle文件中的行导致以下构建错误:错误:任务':data:compileDebugAndroidTestJavaWithJavac'执行失败。java.lang.NoClassDefFoundError:org/jetbrains/kotlin/annotation/AnnotationProcessorWrapper没有那一行,应用程序构建并运行良好,其中还没有Realm代码。项目级build.gradle:allp

FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:

目录Centos7安装MySQL报如下错误:原因一:MySQL没有清理干净: 1、可以使用: rpm-qa|grep-imysql 查找是否装有MySQL2、可以使用: find/-namemysql 查找MySQL安装目录及相关文件并删除 原因二:缺少依赖包autoconf1、通过yum-yinstallautoconf命令安装 autoconf2、如果没有网络,可以前往如下官网下载依赖进行安装Centos7安装MySQL报如下错误:        FATALERROR:pleaseinstallthefollowingPerlmodulesbeforeexecuting/usr/bin/m

java - Kotlin 房间 :Entities and Pojos must have a usable public constructor

当我运行我的应用程序时,出现跟随错误。Error:EntitiesandPojosmusthaveausablepublicconstructor.Youcanhaveanemptyconstructororaconstructorwhoseparametersmatchthefields(bynameandtype).Triedthefollowingconstructorsbuttheyfailedtomatch:ChatMsg(java.lang.String,int):[arg0:null,arg1:null]Error:EntitiesandPojosmusthaveausa

android - 如何在 kotlin android 中使用 responseInputStream.read 编写 while 循环 - - while ((i = responseInputStream.read(byteContainer))

这个问题在这里已经有了答案:Bestwaytotranslatethisjavacodeintokotlin(3个答案)关闭5年前。如何在kotlinandroid中使用while循环和responseInputStream.read这里添加了responseInputStreamreadwhileloop.ktvalresponseInputStream=conn.inputStreamvalresponseStringBuffer=StringBuffer()valbyteContainer=ByteArray(1024)vari:Intwhile((i=responseInput