What steps will reproduce the problem?
1. Create a new Android Studio project.
2. Add com.google.caliper:caliper:1.0-beta-2 as a dependency.
3. Add simple code that calls CaliperMain.main().
2. Try to build and run.
What is the expected output? What do you see instead?
I read that caliper 1.0 isn't yet ready for Android, so I was attempting to get
it working, but encountered a variety of issues, which I'm sharing here in the
hopes that it will be useful when the caliper team attempts to move caliper to
Android.
I didn't expect things to work, but I thought there would just be
dalvik/art-specific issues. Instead, I encountered the following:
1. Guice 3.0 depends on cglib 2.2.1, which pulls in asm 3.1 which conflicts
with a newer version something else pulls in. So I had to use the following in
my build.gradle:
dependencies {
compile ('com.google.caliper:caliper:1.0-beta-2') {
exclude module: 'asm'
}
}
2. The gradle build process doesn't like duplicate files (of which there are
various due to the dependencies), so I had to use the following:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
3. When actually trying to run a caliper benchmark, there is a warning about
FinalizableReferenceQueue (the same as
https://code.google.com/p/google-guice/issues/detail?id=786). It sounds like
this is fixed in Guice 4.0.
4. After that warning is displayed, the process is terminated by the following
exception:
An unexpected exception has been thrown by the caliper runner.
Please see https://sites.google.com/site/caliperusers/issues
com.google.inject.internal.util.$ComputationException:
com.google.inject.internal.util.$ComputationException:
java.lang.ExceptionInInitializerError
at
com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553
)
at
com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419
)
at
com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(Custo
mConcurrentHashMap.java:2041)
at com.google.inject.internal.FailableCache.get(FailableCache.java:50)
at
com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore
.java:49)
at
com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingI
mpl.java:125)
at
com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:507)
at
com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBind
ingProcessor.java:159)
at
com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBind
ingData.java:44)
at
com.google.inject.internal.InternalInjectorCreator.initializeStatically(Internal
InjectorCreator.java:122)
at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator
.java:106)
at
com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:21
7)
at
com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:22
4)
at com.google.caliper.runner.CaliperMain.exitlessMain(CaliperMain.java:120)
at com.google.caliper.runner.CaliperMain.main(CaliperMain.java:81)
at com.google.caliper.runner.CaliperMain.main(CaliperMain.java:69)
at myapp.MainActivity$1.onClick(MainActivity.java:25)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
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:5221)
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:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: com.google.inject.internal.util.$ComputationException:
java.lang.ExceptionInInitializerError
at
com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553
)
at
com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419
)
at
com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(Custo
mConcurrentHashMap.java:2041)
at com.google.inject.internal.FailableCache.get(FailableCache.java:50)
at
com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:65
)
at
com.google.inject.internal.ConstructorInjectorStore.createConstructor(Constructo
rInjectorStore.java:73)
at
com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInject
orStore.java:28)
at
com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjector
Store.java:36)
at
com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjector
Store.java:32)
at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:39)
at
com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:549
)
... 26 more
Caused by: java.lang.ExceptionInInitializerError
Original issue reported on code.google.com by CompareA...@gmail.com on 2 Apr 2015 at 10:47
Original issue reported on code.google.com by
CompareA...@gmail.com
on 2 Apr 2015 at 10:47