git-xuhao / kotlinmvp Goto Github PK
View Code? Open in Web Editor NEW:fire: 基于Kotlin+MVP+Retrofit+RxJava+Glide 等架构实现短视频类小项目,简约风格及详细注释,欢迎 star or fork!
Home Page: https://xuhaoblog.com/KotlinMvp
License: Apache License 2.0
:fire: 基于Kotlin+MVP+Retrofit+RxJava+Glide 等架构实现短视频类小项目,简约风格及详细注释,欢迎 star or fork!
Home Page: https://xuhaoblog.com/KotlinMvp
License: Apache License 2.0
05-13 15:24:52.696 5714-5714/com.hazz.kotlinmvp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hazz.kotlinmvp, PID: 5714
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://github.com/git-xuhao/KotlinMvp }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1781)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1501)
at android.app.Activity.startActivityForResult(Activity.java:3788)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:68)
at android.app.Activity.startActivityForResult(Activity.java:3749)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:751)
at android.app.Activity.startActivity(Activity.java:4059)
at android.app.Activity.startActivity(Activity.java:4027)
at com.hazz.kotlinmvp.ui.activity.AboutActivity$initView$2.onClick(AboutActivity.kt:36)
at android.view.View.performClick(View.java:4781)
at android.view.View$PerformClick.run(View.java:19874)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697)
I accounter this bug in some pos machines . Maybe you can avoid the problem with the code below in AboutActivity.
val uri = Uri.parse("https://github.com/git-xuhao/KotlinMvp") val intent = Intent(Intent.ACTION_VIEW, uri) startActivity(intent)
AndroidStudio 3.1.3编译报错:
3rd-party Gradle plug-ins may be the cause
Could not find method ext() for arguments [config_6swj9jmyi6dxtyps0pjmr022u$_run_closure1@5ac625a2] on root project 'KotlinMvp-master' of type org.gradle.api.Project.
@SuppressLint("SetTextI18n")这是检测什么的?
CreateProcess error=2, 系统找不到指定的文件
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\Users\HP\AppData\Local\Android\Sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:220)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:204)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:340)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39)
... 6 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'C:\Users\HP\AppData\Local\Android\Sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
... 7 more
Caused by: java.io.IOException: Cannot run program "C:\Users\HP\AppData\Local\Android\Sdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip" (in directory "D:\git_workpace\work\KotlinMvp\app"): CreateProcess error=2, 系统找不到指定的文件。
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 10 more
Caused by: java.io.IOException: CreateProcess error=2, 系统找不到指定的文件。
有空帮我定制?[email protected]
2020-04-24 11:49:07.846 3388-3388/com.hazz.kotlinmvp A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 3388 (.hazz.kotlinmvp)
2020-04-24 11:49:07.957 3440-3440/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-04-24 11:49:07.957 3440-3440/? A/DEBUG: Build fingerprint: 'Xiaomi/libra/libra:7.0/NRD90M/V10.1.1.0.NXKCNFI:user/release-keys'
2020-04-24 11:49:07.958 3440-3440/? A/DEBUG: Revision: '0'
2020-04-24 11:49:07.958 3440-3440/? A/DEBUG: ABI: 'arm'
2020-04-24 11:49:07.958 3440-3440/? A/DEBUG: pid: 3388, tid: 3388, name: .hazz.kotlinmvp >>> com.hazz.kotlinmvp <<<
2020-04-24 11:49:07.958 3440-3440/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2020-04-24 11:49:07.960 3440-3440/? A/DEBUG: Abort message: 'art/runtime/java_vm_ext.cc:475] JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.NoSuchMethodError: no static or non-static method "Landroid/support/v8/renderscript/RenderScript;.nDeviceDestroy(J)V"'
2020-04-24 11:49:07.960 3440-3440/? A/DEBUG: r0 00000000 r1 00000d3c r2 00000006 r3 00000008
2020-04-24 11:49:07.960 3440-3440/? A/DEBUG: r4 f04fe590 r5 00000006 r6 f04fe538 r7 0000010c
2020-04-24 11:49:07.960 3440-3440/? A/DEBUG: r8 00000000 r9 ed86a12c sl 00001a92 fp ed82f70f
2020-04-24 11:49:07.960 3440-3440/? A/DEBUG: ip 0000000b sp ff971f60 lr ef19e2b7 pc ef1a0b38 cpsr 200f0010
GlideApp没了?
你好,我下载了你的项目,编译后提示缺少GlideApp类,可以提供一下吗?
com.hazz.kotlinmvp.glide.GlideApp
特别棒的项目,请问,之后还会有更新吗?比如完成未完成的功能。
用了什么屏幕适配方案代码找没看出来
使用foreach可能会造成concurrentmodifiedexception(删除第二个元素后会发生)。
可以使用迭代器来删除。
项目全局搜下 foreach 的使用
proguard里面应该保留所有bean的类型:
-keep class com.hazz.kotlinmvp.mvp.model.bean.** { *; }
大家可以参考一下,共同学习,有参考本作者的代码,感谢!https://github.com/leifu1107/MvpKotlin
GlideApp怎么没有呢,没有找到
我之前在把mvp从java转到kotlin时,碰到基类里调用attachView(this)这里编译不过,看了你的源码,你是在每个子view里都调用一遍attachView
CategoryDetailActivity:
init {
mPresenter.attachView(this)
}
如果基类调用,kotlin会出现 Type mismatch,在基类中有解决方法吗,不是用Java解决
abstract class MvpActivity<P : IPresenter<*>> : RxAppCompatActivity(), IView {
protected var mPresenter: P? = null
/**
* 初始化presenter
*/
abstract fun initPresenter(): P
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (null == mPresenter) {
mPresenter = initPresenter()
}
// 绑定View
if (null != mPresenter) {
// Type mismatch.
mPresenter!!.attachView(this)
}
请问您能改进一下,对基类BaseBean继承封装,和对基类错误码进行统一处理码,以及对统一解析bean
现在BaseFragment中onViewCreated函数中mLayoutStatusView的应该使用setOnRetryClickListener接口吧,不然会导致点击事件失效的
在Android8.0手机上运行咱们的项目 sdk版本改成27的时候会报一个 Only fullscreen activities can request orientation
经常会报这个错误,然后就404,但是postman请求正常
获得actionUrl后怎么访问这个url
BasePresenter已经实现了IPresenter接口,contract中声明的Presenter又实现了IPresenter接口,这块是不是有点多余了
import com.hazz.kotlinmvp.glide.GlideApp
There is no GlideApp in glide folder.
这么项目就差一点就是完全是用kotlin来写的了
android8.0,安装的你打好的包
哥们,我是新手,模仿你这个写个demo。你那里边有个第三方包,怎么加入到工程中,用的Mac AS,不太会
请问内存泄漏的地方在哪里?那个multiple-status-view有什么用啊?
对SharedPreferences等封装通过委托机制来实现没有问题,但是类中关于其他的方法,例如clearPreference等,只能先通过委托来获取Preference对象实例,才能调用这些方法,这是有问题的,最直接是将这些方法用companion object包裹
我有一个疑问,您的UDID是怎么生成的呀,我看您的代码里面写的是一串代码
tab_layout.setTabData(mTabEntities)
在app启动的时候 mainactivity界面的 在initTab时 tab_layout.setTabData(mTabEntities) 报空指针;customIntent = null
安装后,所有页面都显示获取数据失败
你可以自己把apk打包好了放在项目的目录下,一同上传的GitHub,即可通过访问GitHub下载文件。然后讲地址保存下来,放到MD文件中即可。
@git-xuhao 接口文档有没有?
跟后台确定是这样的形式:
class BaseResponse(val success :Boolean,
val obj:T,
val msg:String)
运行时报解析数据异常。请问该如何解决呢?谢谢。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.