Gradle依赖项:
compile 'com.google.dagger:dagger:2.9'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
kapt 'com.google.dagger:dagger-compiler:2.9'
provided "com.google.auto.value:auto-value:1.4.1"
annotationProcessor "com.google.auto.value:auto-value:1.4.1"
Run Code Online (Sandbox Code Playgroud)
得到这个堆栈跟踪:
:presentation:kaptDevDebugKotlin
e: @AutoValue public abstract class Categories implements CategoriesModel{
e: ^
e: symbol: class CategoriesModel
e: path/Categories.java:13: error: cannot find symbol
w: warning: The following options were not recognized by any processor: '[kapt.kotlin.generated]'
w:
e: org.jetbrains.kotlin.kapt3.diagnostic.KaptError: Error while annotation processing
at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:90)
at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:42)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:149)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:76)
at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:89)
at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:99)
at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:76)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.analyze(KotlinToJVMBytecodeCompiler.kt:347)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:104)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:336)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:131)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:165)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:178) …Run Code Online (Sandbox Code Playgroud) 当我跑步时,./gradlew assembleDebug我得到:
:app:dexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/grub/Main/android-sdk-linux/build-tools/19.1.0/dx --dex --num-threads=4 --output
Run Code Online (Sandbox Code Playgroud)
合并类和jar列表:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Run Code Online (Sandbox Code Playgroud)
它与此问题非常相似,问题应该在多个support-v4库中.我清理了一下build.gradle:
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 8
versionName "2.1.17"
}
dependencies {
compile fileTree(dir: 'libs', …Run Code Online (Sandbox Code Playgroud) LeakCanary在我的代码中发现了泄漏
* classifieds.yalla.features.ad.page.seller.SellerAdPageFragment has leaked:
* GC ROOT android.view.inputmethod.InputMethodManager$1.this$0 (anonymous subclass of com.android.internal.view.IInputMethodClient$Stub)
* references android.view.inputmethod.InputMethodManager.mNextServedView
* references android.support.v4.widget.DrawerLayout.mContext
* references classifieds.yalla.features.host.HostActivity.fragNavController
* references com.ncapdevi.fragnav.FragNavController.mFragmentManager
* references android.support.v4.app.FragmentManagerImpl.mCreatedMenus
* references java.util.ArrayList.elementData
* references array java.lang.Object[].[0]
* leaks classifieds.yalla.features.ad.page.seller.SellerAdPageFragment instance
Run Code Online (Sandbox Code Playgroud)
但当我看着 FragmentManagerImpl
FragmentManagerImpl.mCreatedMenus得到清理时我没有找到.我找到的唯一代码是添加新片段的时候.不应该以某种方式管理它吗?
public boolean dispatchCreateOptionsMenu(Menu menu, MenuInflater inflater) {
boolean show = false;
ArrayList<Fragment> newMenus = null;
if (mAdded != null) {
for (int i=0; i<mAdded.size(); i++) {
Fragment f = mAdded.get(i);
if (f != null) {
if (f.performCreateOptionsMenu(menu, …Run Code Online (Sandbox Code Playgroud) android android-fragments android-support-library leakcanary
Proguard保留了类和包的名称,但是混淆了字段和方法.在我的映射文件中,我看到所有文件包和文件名都保持不变,但我们不需要它.我的Proguard的档案:
-optimizationpasses 5
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dontusemixedcaseclassnames
-allowaccessmodification
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-repackageclasses "com.example"
-renamesourcefileattribute SourceFile
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service??
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-dontnote com.android.vending.licensing.ILicensingService
#your package path where your gson models are stored
-keep class …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Realm与RxJava和Retrofit,DanLew 在这里描述的方式来汇总来自领域和改造的输入但是如果我将链接添加到链中它会被卡住
Observable.concat(countryStorage.restoreAsObservable(),
networkService.api()
.getCountries()
.doOnNext(countryStorage::save))
.first()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(//never reaching here)
Run Code Online (Sandbox Code Playgroud)
存储
@Override public Observable<List<Country>> restoreAsObservable() {
Realm realm = realmProvider.get();
return realm.where(Country.class)
.findAll()
.asObservable()
.map(countries -> return realm.copyFromRealm(countries))
.first(countries -> return !countries.isEmpty())
.doOnCompleted(realm::close());
}
Run Code Online (Sandbox Code Playgroud)
似乎这可能发生,可观察到的是来自Realm的热点,但在文档中没有任何关于它的内容以及我如何与其他可观察者组成Realm?
更新: 它变成了旧的方式它工作正常.关于新api的问题仍然存在.
return Observable.just(
realm.copyFromRealm(realm.where(Country.class).findAll()))
.filter(countries -> !countries.isEmpty())
.doOnCompleted(realm::close);
Run Code Online (Sandbox Code Playgroud) 我package com.android.server;从Android的源代码中查看.有一些文档表明,在系统启动时加载其他重要服务作为Activity/Package/Power等是主要的角色,但这只是我的猜测.
有人可以更详细地解释什么是SystemServer的关键角色?
目前,我只有一个gradle.properties文件。它专门为可用内存不足的CI配置,因为否则CI将会崩溃
org.gradle.jvmargs=-Xmx1500m -XX:MaxPermSize=512m
Run Code Online (Sandbox Code Playgroud)
但是,当我在本地计算机上进行构建时,速度非常慢,并且本地计算机允许更多的内存使用。我可以gradle.properties为CI和AndroidStudio 单独设置吗?
continuous-integration android gradle android-studio android-gradle-plugin
如何在密封的通用层次结构中定义对象?对象声明不适用于泛型.
sealed class PaginationViewState<T> {
object LoadingFirstPage: PaginationViewState<T>()//doesn't work
object LoadingPage: PaginationViewState<T>()//doesn't work
data class DataLoaded<T>(val data: List<T>): PaginationViewState<T>()
data class DataLoadedFromCache<T>(val data: List<T>): PaginationViewState<T>()
data class Failure<T>(val e: Throwable): PaginationViewState<T>()
}
Run Code Online (Sandbox Code Playgroud) 今天我们发现 Crashlytics 无法捕捉到 SIGSEGV 崩溃,但 google play 控制台可以。我们非常惊讶地看到 Play 控制台中有许多此类崩溃。
我们希望将崩溃报告集中在一处。我们可以使用 crashlytics 捕获 SIGSEGV 崩溃吗?
我在kotlin有一个功能
fun printExecutionTime(block: () -> Any) {
run {
val currentTimeMillis = System.currentTimeMillis()
block()
Logr.d("Execution time of " + block.javaClass.name + " -> " + System.currentTimeMillis().minus(currentTimeMillis))
}
}
Run Code Online (Sandbox Code Playgroud)
在java代码中,我想传递void引用函数作为参数,但不能返回值的bcs
PerformanceKt.printExecutionTime(this::voidFunc);
Run Code Online (Sandbox Code Playgroud)
一种方法是使用界面
interface Action {
fun call()
}
Run Code Online (Sandbox Code Playgroud)
是否可以在没有额外接口的情况下在kotlin中声明它,所以上面的代码可以工作?
android ×6
kotlin ×3
gradle ×2
auto-value ×1
crashlytics ×1
java ×1
kapt ×1
leakcanary ×1
proguard ×1
realm ×1
rx-java ×1