Tag: android library

如何显示从Android库反编译的Kotlin代码

我写了一个已上传到私人服务器的库。 当我将库作为依赖包含在我的应用程序项目中,并查看其中一个库类的源代码时,源代码实际上并未反编译。 它只显示类名和方法。 例如: package com.example.library.ui public final class RoundedDrawable public constructor() : android.graphics.drawable.Drawable { public final var backgroundColor: kotlin.Int /* compiled code */ // … other similar fields public open fun draw(canvas: android.graphics.Canvas): kotlin.Unit { /* compiled code */ } // … other similar functions } 正如你所看到的,它只显示/* compiled code */注释,而不是完整的源代码。 有一个选项提交给“反编译为Java”; 哪些工作,但我宁愿看到Kotlin的来源。 这可能吗? 我发现类似的问题 […]

无法使用kotlin库

我正在尝试将这个库用于我的应用程序,但是因为它是在kotlin中创建的,所以我正面临着这个问题。 我下载了这个库的模块,并在项目中导入这个模块,但在初始状态我没有findgettin kotlin插件,所以我改变了gradel 这个 apply plugin: ‘com.android.library’ apply plugin: ‘kotlin-android’ android { compileSdkVersion 26 buildToolsVersion “26.0.2” defaultConfig { minSdkVersion 17 targetSdkVersion 26 versionCode 1 versionName “1.0” } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’ } } sourceSets { main.java.srcDirs += ‘src/main/kotlin’ } resourcePrefix “yal_ms_” } buidscript { ext.kotlin_version = ‘1.0.1-2’ repositories { jcenter() […]

我在Signal android项目中使用volleyplus和volley库

android { compileSdkVersion 23 buildToolsVersion '26.0.2' defaultConfig { applicationId "testing.gps_service" minSdkVersion 11 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.volley:volley:1.0.0' compile 'dev.dworks.libs:volleyplus:+' compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7' testCompile 'junit:junit:4.12' compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" } repositories { mavenCentral() google() […]

Gradle安装错误:Javadoc

我想上传一个android库自动到bintray。 我有这个应用程序gradle代码: apply plugin: 'com.android.library' apply plugin: 'kotlin-android' ext { bintrayRepo = 'maven' bintrayName = 'CurrentCenterPositionMap' publishedGroupId = 'renatamelo@patriauto.org' libraryName = 'CurrentCenterPositionMap' artifact = 'current-center-position-map' libraryDescription = 'A library to mark the center of a map with moveing animations' siteUrl = 'https://github.com/leandroBorgesFerreira/CurrentCenterPositionMap' gitUrl = 'https://github.com/leandroBorgesFerreira/CurrentCenterPositionMap.git' libraryVersion = '0.8.1' developerId = 'leandroBorgesFerreira' developerName = 'Leandro Borges […]

如何在库中使用Realm

我想了解如何在我正在使用的库中使用Realm,经过几天的研究,我现在了解RealmModules(如果来自Realm的读者,请务必改进关于在库中使用的文档)。 我已经做了一个简单的类,给我的库配置领域: object ChatRealm { fun getChatRealm(): Realm{ val config = RealmConfiguration.Builder() .name("mtchat_realmDB") .schemaVersion(2) .deleteRealmIfMigrationNeeded() .modules(ChatModule()) .build() return Realm.getInstance(config) } } 模块是这个 @RealmModule(library = true, allClasses = true) class ChatModule {} 并在项目应用程序类我安装领域像这样 class App: Application() { override fun onCreate() { super.onCreate() initRealm() setupRealm() } private fun initRealm() { Realm.init(this) } private fun setupRealm(){ Realm.setDefaultConfiguration( RealmConfiguration.Builder() […]

Android库,Kotlin和Dagger2

我正在构建一个包含两个模块的应用程序:核心模块,即Android库(com.android.library)和应用程序模块(com.android.application)。 将Java文件转换为Kotlin后,该项目不编译,给我一个错误,没有找到生成的Dagger 2文件(未解决的参考)。 但是那些目前正在生成的文件是: …核心\编译\生成的\源\ kapt \ {释放我的\核心\命名空间} \ DaggerBaseComponent.java 我错过了什么? build.gradle(核心模块) apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-android-extensions' … android { … sourceSets { main.java.srcDirs += 'src/main/kotlin' } } dependencies { … // Dagger. kapt "com.google.dagger:dagger-compiler:2.10" compile 'com.google.dagger:dagger:2.10' provided 'javax.annotation:jsr250-api:1.0' // Kotlin compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } build.gradle(应用程序模块) apply plugin: 'com.android.application' […]