将Android Studio更新到2.3版之后。每次我刷我的ViewPager时,我都会收到此错误并且应用程序崩溃:
03-23 17:19:19.437 28523-28523/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.irokotv.plus, PID: 28523
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper;
at android.support.v7.widget.DefaultItemAnimator.resetAnimation(DefaultItemAnimator.java:515)
at android.support.v7.widget.DefaultItemAnimator.animateAdd(DefaultItemAnimator.java:218)
at android.support.v7.widget.SimpleItemAnimator.animateAppearance(SimpleItemAnimator.java:114)
at android.support.v7.widget.RecyclerView.animateAppearance(RecyclerView.java:3528)
at android.support.v7.widget.RecyclerView$4.processAppeared(RecyclerView.java:461)
at android.support.v7.widget.ViewInfoStore.process(ViewInfoStore.java:249)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3385)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3135)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3568)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1766)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131)
at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1364)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:846)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:818)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2615)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2331)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1490)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7027)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:638)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
应用程序用于在更新之前正常运行。我已经清理了这个项目。使缓存无效并运行gradle clean。不知道我还能做什么/尝试。我的同事可以构建项目,它可以毫无问题地工作。
答案 0 :(得分:21)
将此代码写入build.gradle
文件夹
app
文件中
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
我希望这会对你有所帮助,编码很快
答案 1 :(得分:12)
我使用的是版本26.0.1(在Android Studio 3.0 beta 2上)支持库有47版本,我遇到了同样的问题。对我有用的是从所有gradle文件中删除/注释这一行:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
然后从" Er Pathak Harshal"添加以下代码:在build.gradle文件中注释(Module:app and Module:Library)的底部:
Scale <- c(3.913934,3.996000,4.012884,3.925220,3.856707,3.849608,
3.820578,3.943110,3.945975,3.842338,3.891791,3.933083,3.993944,3.907775,
3.847120,3.853263,3.917156,4.028956,3.878879,3.753880,3.969074,3.818923,
3.855913,3.993075,3.985828,3.914240,3.854336,3.620460,3.848180,3.843788,
3.830617,3.841890,3.879547,3.904059) ##Length 34
bins <- seq(0.5, 25, by = 0.5) # length 50
shape <- 2
Wind_prob <- matrix(NA_real_, length(bins), length(Scale))
for (j in seq_along(Scale)) {
for (i in seq_along(bins)) {
Wind_prob[i, j]<-(0.5*(exp(-1*(bins[i]/shape)^shape))*
(shape/as.numeric(Scale[j]))*
((bins[i]/as.numeric(Scale[j]))^(shape-1)))
}
}
请注意,如果您有超过1个build.gradle文件,例如(模块:库和模块:yourapp),您需要在两个文件中添加该代码以使其正常工作。
答案 2 :(得分:9)
您可以将支持v7 lib版本更改为26.0.0-alpha1 shuch:
curl 'http://<Your Address>/<Web Service End Address>?<Variable1=value1&Varuable2=value2'
我希望这会对你有所帮助
答案 3 :(得分:7)
我能够弄清楚问题是什么。 Android工作室将Android支持存储库&#34;(位于sdk管理器中)更新到版本46,其中包含一堆针对Android O的Alpha支持库。我又回到了版本25,问题得到了解决。显然,Android Studio 2.3依赖于Alpha支持库,导致依赖项不匹配,从而导致应用程序崩溃。
答案 4 :(得分:1)
只需生成一个“APK”而不是即时运行,它就能完美运行。
答案 5 :(得分:1)
使用最新的支持库。 (最新的稳定版本对我有用 - 即目前从27.1.1或更高版本升级到28.0.0修复它。)
答案 6 :(得分:1)
我修复了Gradle app中的错误更新版本
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
要
implementation 'com.android.support:design:27.1.1’
implementation 'com.android.support:support-v4:27.1.1’
答案 7 :(得分:0)
我也有同样的问题。狩猎一整天后一无所获。然后在早上以新鲜的心态,我意识到我的一个自定义库使用java 8功能,我的app模块gradle文件无法启用它。
所以我只是在build.gradle(Modeule:app)
文件中添加了以下行以使其正常工作:
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
我希望它也有助于其他人。
答案 8 :(得分:0)
我在整合aviary sdk
时遇到了同样的问题,然后解决了降级问题,如下所示。 。
compile 'com.android.support:appcompat-v7:25.4.0'
的兼容性targetSdkVersion 25
compileSdkVersion 25
答案 9 :(得分:0)
确保在您的build.gradle
文件中,所有实现都具有相同的版本。
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'