gpt4 book ai didi

java - 错误 :Unexpected type tag 13996 found. 或为方法数超过 64K 的应用启用 Multidex

转载 作者:搜寻专家 更新时间:2023-11-01 09:29:33 25 4
gpt4 key购买 nike

我得到了

为方法数超过 64K 的应用启用 Multidex

错误。我搜索了一下,解决方案在这里:https://developer.android.com/studio/build/multidex.html

当我应用 android 告诉它自己的解决方案时,我得到另一个错误:

错误:发现意外类型标签 13996。

我该怎么办?

更多详情: 网页端:https://developer.android.com/studio/build/multidex.html 基本上是说将 multiDexEnabled true 添加到 app level build gradle 的 defaultConfig 并添加 compile 'com.android.support:multidex:1.0.1'依赖关系。

android {
defaultConfig {
...
multiDexEnabled true
}
...
}

dependencies {
compile 'com.android.support:multidex:1.0.1'
}

根据下面的文章,我需要扩展我的应用程序类 MultiDexApplication 像这样

if you do override the Application class, change it to extend MultiDexApplication (if possible) as follows: public class MyApplication extends MultiDexApplication { ... }

import android.support.multidex.MultiDexApplication;

import com.engly.learnenglish.app.util.model.VocabularyModel;
import com.onesignal.OneSignal;

import java.util.ArrayList;
import java.util.List;

public class App extends MultiDexApplication {

private static App instance = null;
private static List<VocabularyModel> vocabularyModelList;

@Override
public void onCreate() {
super.onCreate();
instance = this;
vocabularyModelList = new ArrayList<>();
OneSignal.startInit(this)
.inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
.unsubscribeWhenNotificationsAreDisabled(true)
.init();
}

public static App getInstance() {
if (instance == null) {
instance = new App();
}
return instance;
}

public static List<VocabularyModel> getVocabularyModelList() {
return vocabularyModelList;
}

public static void setVocabularyModelList(List<VocabularyModel> vocabularyModelList) {
App.vocabularyModelList = vocabularyModelList;
}
public static void addVocabularyToList(VocabularyModel vocabularyModel){
App.vocabularyModelList.add(vocabularyModel);
}

}

当我应用解决方案时出现此错误

Error:Unexpected type tag 13996 found.

这是我的项目级gradle

buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.2'
//in sake of butter knife
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
/*
App version
*/
versionCode = 8
versionName = '2.0.0'


/*
SDK version
*/
buildToolsVersion = '25.0.0'
compileSdkVersion = 25
minSdkVersion = 16
targetSdkVersion = 25

/*
Dependency versions
*/
supportLibVersion = '25.0.0'
butterknifeVersion = '8.4.0'
commonsioVersion = '2.5'
appacheCommonsVersion = '3.4'
googleGsonVersion = '2.7'
relexCircleIndicatorVersion = '1.2.2@aar'
viewpagerTransformsVersion = '1.2.32@aar'
pageLoaderVersion = '0.0.2'
topSnackbarVersion = '1.1.1'
retrofit2Version = '2.0.2'
picassoVersion = '2.5.2'
recyclerTabLayoutVersion = '1.1.0'
okhttpVersion = '2.4.0'

/*
Dependencies
*/
supportLibAppCompat = "com.android.support:appcompat-v7:$supportLibVersion"
supportLibDesign = "com.android.support:design:$supportLibVersion"
supportLibRecyclerView = "com.android.support:recyclerview-v7:$supportLibVersion"
supportLibPercentLayout = "com.android.support:percent:$supportLibVersion"
supportLibCardView = "com.android.support:cardview-v7:$supportLibVersion"
butterknife = "com.jakewharton:butterknife:$butterknifeVersion"
butterknifeApt = "com.jakewharton:butterknife-compiler:$butterknifeVersion"
commonsIo = "commons-io:commons-io:$commonsioVersion"
appacheCommons = "org.apache.commons:commons-lang3:$appacheCommonsVersion"
googleGson = "com.google.code.gson:gson:$googleGsonVersion"
relexCircleIndicator = "me.relex:circleindicator:$relexCircleIndicatorVersion"
picasso = "com.squareup.picasso:picasso:$picassoVersion"
okhttp = "com.squareup.okhttp:okhttp:$okhttpVersion"
retrofit2 = "com.squareup.retrofit2:retrofit:$retrofit2Version"
retrofit2Converter = "com.squareup.retrofit2:converter-gson:$retrofit2Version"
viewpagerTransforms = "com.ToxicBakery.viewpager.transforms:view-pager-transforms:$viewpagerTransformsVersion"
pageLoader = "id.arieridwan:pageloader:$pageLoaderVersion"
topSnackbar = "com.androidadvance:topsnackbar:$topSnackbarVersion"
recyclerTabLayout = "com.nshmura:recyclertablayout:$recyclerTabLayoutVersion"
}

这是我的应用级gradle

plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.0'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.google.com' }
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'

android {
dexOptions {
jumboMode true
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
manifestPlaceholders = [onesignal_app_id : "2fe20af9-bdcf-49cd-bbfe-6ffd8f11f8c2",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
applicationId 'com.engly.learnenglish.app'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
vectorDrawables {
useSupportLibrary = true
}
generatedDensities = []
multiDexEnabled true
}
lintOptions
{
checkReleaseBuilds false
abortOnError false

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
buildToolsVersion '26.0.2'
}

dependencies {
implementation 'com.google.firebase:firebase-messaging:11.8.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
//support lib
compile rootProject.ext.supportLibAppCompat
compile rootProject.ext.supportLibPercentLayout
compile rootProject.ext.supportLibRecyclerView
compile rootProject.ext.supportLibCardView
compile rootProject.ext.supportLibDesign
//butterknife
compile rootProject.ext.butterknife
annotationProcessor rootProject.ext.butterknifeApt
//commons
compile rootProject.ext.commonsIo
compile rootProject.ext.appacheCommons
//gson
compile rootProject.ext.googleGson
//circle indicator
compile rootProject.ext.relexCircleIndicator
//piccasso
compile rootProject.ext.picasso
//retrofit
compile rootProject.ext.okhttp
compile rootProject.ext.retrofit2
compile rootProject.ext.retrofit2Converter
//recyclerview tablayout
compile rootProject.ext.recyclerTabLayout
//viewpager animation
compile rootProject.ext.viewpagerTransforms
//page loader
compile rootProject.ext.pageLoader
//top position snackbar
compile rootProject.ext.topSnackbar
implementation 'com.facebook.android:facebook-login:[4,5)'
compile 'com.android.support:multidex:1.0.1'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.github.michaelye.easydialog:easydialog:1.4'
compile 'com.hbb20:ccp:1.7.8'
compile 'com.googlecode.libphonenumber:libphonenumber:8.4.2'
compile 'com.google.android.exoplayer:exoplayer:r2.4.1'
compile 'com.mikhaellopez:circularprogressbar:1.1.1'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.victor:lib:1.0.4'
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true
}
compile 'me.grantland:autofittextview:0.2.1'
compile 'com.appsee:appsee-android:2.3.3'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

来自 idea.log 的完整版本 gradle 错误

  com.intellij.openapi.externalSystem.model.ExternalSystemException: Unexpected type tag 13996 found.
at com.android.tools.idea.gradle.project.sync.idea.ProjectImportErrorHandler.getUserFriendlyError(ProjectImportErrorHandler.java:85)
at com.android.tools.idea.gradle.project.sync.idea.AndroidGradleProjectResolver.getUserFriendlyError(AndroidGradleProjectResolver.java:414)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:158)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:906)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:886)
at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:218)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:139)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:79)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.lambda$resolveProjectInfo$0(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:45)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:66)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:139)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:125)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:388)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:445)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:726)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:176)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:556)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:137)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Unexpected type tag 13996 found.
at org.gradle.internal.serialize.DefaultSerializerRegistry$TaggedTypeSerializer.read(DefaultSerializerRegistry.java:142)
at org.gradle.internal.serialize.Serializers$StatefulSerializerAdapter$1.read(Serializers.java:36)
at org.gradle.internal.remote.internal.inet.SocketConnection.receive(SocketConnection.java:79)
at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:75)
at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:35)
at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:210)
at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:178)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:141)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:92)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:60)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:41)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:60)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:34)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:143)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:128)
at org.gradle.tooling.internal.provider.DefaultConnection.run(DefaultConnection.java:208)
at org.gradle.tooling.internal.consumer.connection.CancellableConsumerConnection$CancellableActionRunner.run(CancellableConsumerConnection.java:99)
at org.gradle.tooling.internal.consumer.connection.AbstractConsumerConnection.run(AbstractConsumerConnection.java:62)
at org.gradle.tooling.internal.consumer.connection.ParameterValidatingConsumerConnection.run(ParameterValidatingConsumerConnection.java:53)
at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter$1.run(DefaultBuildActionExecuter.java:71)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:84)
at org.gradle.tooling.internal.consumer.connection.CancellableConsumerActionExecutor.run(CancellableConsumerActionExecutor.java:45)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58)
at org.gradle.tooling.internal.consumer.connection.RethrowingErrorsConsumerActionExecutor.run(RethrowingErrorsConsumerActionExecutor.java:38)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)

最佳答案

Error:Unexpected type tag 13996 found.

原因是一个信号。当您将 multiDexEnabled true 与 onesignal 一起使用时,它会导致 Unexpected type tag 13996 found 错误。

应该是bug。将 版本“0.8.0” 更新为 版本“0.8.1” 后,问题将得到修复。

 plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}

更多信息:https://github.com/OneSignal/OneSignal-Gradle-Plugin/issues/15https://github.com/OneSignal/OneSignal-Android-SDK/issues/391

**

但主要问题是为方法数超过 64K 的应用启用 Multidex

**

您可以通过此网页端信息修复它:https://developer.android.com/studio/build/multidex.html

我所做的是检查我的 Module:app 级别 gradle 中的所有库,以便找到未使用的资源和库。问题的平均原因是使用了很多方法。如果你的项目不是很大,你可能不会写那么多方法。事实上,原因应该是您经常使用的库或从不从中调用任何单一方法。您应该找到未使用的库或您添加的不必要的库。当您从这个库中清理您的项目时,问题应该得到解决。如果您无法删除任何库,请按照以下步骤操作:

https://developer.android.com/studio/build/multidex.html

关于java - 错误 :Unexpected type tag 13996 found. 或为方法数超过 64K 的应用启用 Multidex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48213865/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com