Skip to content

Quickly create entrances for debugging various functions

License

Notifications You must be signed in to change notification settings

caldremch/entrances

Repository files navigation

main

entry entry-annotation entry-compiler
maven maven maven

Entrance

Quickly create entrances for debugging various functions

###如何使用

1.在 build.gradle 文件中 添加依赖

#####kotlin

apply plugin: 'com.google.devtools.ksp'
.....
.....
dependencies {
	implementation 'io.github.caldremch:entry:1.6.3'
	ksp 'io.github.caldremch:entry-compiler:1.6.3'
}
java 使用旧版compiler 1.6.2
dependencies {
	implementation 'io.github.caldremch:entry:1.6.3'
	annotationProcessor 'io.github.caldremch:entry-compiler:1.6.2'
}  

2.创建入口

@Entry
class AEntry : IEntry{
    
    override fun getTitle(): String {
        return "AEntry"
    }

    override fun onClick(context: Context) {
        Toast.makeText(context, "it a entry", Toast.LENGTH_SHORT).show()
    }
}

3.配置入口Activity

<activity android:name="com.caldremch.android.entry.EntryActivity">      
     <intent-filter>                                                      
         <action android:name="android.intent.action.MAIN" />             
                                                                          
         <category android:name="android.intent.category.LAUNCHER" />     
     </intent-filter>                                                     
</activity>                                                              

Ok.

问题记录

1.auto-service对kotlin项目不生效, 需要手动配置

src/main/
创建 resources/META-INF/services/javax.annotation.processing.Processor
同时在javax.annotation.processing.Processor文件中加上
包名.注解器名字