Ошибка transformClassesWithDexForDebug
Я разрабатываю приложение, используя android studio 2.3.2
, Я использовал Jython
Кроме того, потому что мне нужен класс Python в моем приложении. Я уже установил Jython 2.7.0
и добавить его в path
Я пытался решить мою проблему, проверяя другие вопросы, такие как:
- Ошибка: не удалось выполнить задачу ':app:transformClassesWithDexForDebug'
- /questions/14186357/comandroidbuildtransformapitransformexception
- Не удалось выполнить задачу ':app:transformClassesWithDexForDebug' при реализации входа в Google для Android
- Android Studio TransformException: ошибка: сбой при выполнении задачи ':app:transformClassesWithDexForDebug'
- Android - ошибка: не удалось выполнить задачу ':app:transformClassesWithDexForRelease'
- /questions/14186357/comandroidbuildtransformapitransformexception
- ....
Это мой код:
Интерфейс SA
package com.aso.mdasa.mdasa;
interface SA {
Set resultCorpus(String DataBase, String polarity, String feature);
int resultSearch(String tweet);
}
Анализ настроений
class SentimentAnalysis {
private final Class interfaceType;
private final PyObject klass;
// Constructor obtains a reference to the importer, module, and the class name
private SentimentAnalysis(PySystemState state, Class interfaceType, String moduleName, String className) {
this.interfaceType = interfaceType;
PyObject importer = state.getBuiltins().__getitem__(Py.newString("__import__"));
PyObject module = importer.__call__(Py.newString(moduleName));
klass = module.__getattr__(className);
System.err.println("module=" + module + ",class=" + klass);
}
// This constructor passes through to the other constructor
public SentimentAnalysis(Class interfaceType, String moduleName, String className) {
this(new PySystemState(), interfaceType, moduleName, className);
}
// All of the followng methods return
// a coerced Jython object based upon the pieces of information
// that were passed into the SentimentAnalysis. The differences are
// between them are the number of arguments that can be passed
// in as arguents to the object.
public Object createObject() {
return klass.__call__().__tojava__(interfaceType);
}
public Object createObject(Object arg1) {
return klass.__call__(Py.java2py(arg1)).__tojava__(interfaceType);
}
Object createObject(Object arg1, Object arg2) {
return klass.__call__(Py.java2py(arg1), Py.java2py(arg2)).__tojava__(interfaceType);
}
public Object createObject(Object arg1, Object arg2, Object arg3)
{
return klass.__call__(Py.java2py(arg1), Py.java2py(arg2),
Py.java2py(arg3)).__tojava__(interfaceType);
}
private Object createObject(Object args[], String keywords[]) {
PyObject convertedArgs[] = new PyObject[args.length];
for (int i = 0; i < args.length; i++) {
convertedArgs[i] = Py.java2py(args[i]);
}
return klass.__call__(convertedArgs, keywords).__tojava__(interfaceType);
}
public Object createObject(Object... args) {
return createObject(args, Py.NoKeywords);
}
}
SAPython.py
from com.aso.mdasa.mdasa import SA
# Building object that subclasses a Java interface
from senticnet.senticnet import Senticnet
import pymysql
import pandas as pd
import sys
class SAPython (SA) :
__sn = Senticnet('ar')
def __init__(DBase) :
self.__connect(DBase)
def resultCorpus (self, polarity, feature = None):
result = {}
.....
return result
def resultSearch (self, tweet) :
return self.__calcTweetPolarity(tweet, len(tweet))
....
класс ResultSearch
public class ResultSearch extends FragmentActivity{
private String search;
private ImageView img ;
public static final int[] photos = {
R.drawable.v_bad,
R.drawable.bad,
R.drawable.good,
R.drawable.v_good } ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.result_search);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.second, menu);
return true;
}
public void onStart(){
super.onStart();
search = getIntent().getStringExtra("text");
img = (ImageView) findViewById(R.id.img);
sentimentAnalysis();
}
public void sentimentAnalysis() {
SentimentAnalysis sentimentA = new SentimentAnalysis(
SA.class, "SAPython", "SentimentAnalysis");
SA sa = (SA) sentimentA.createObject();
double result = sa.resultSearch(search);
if (result < -0.5)
img.setBackground(getResources().getDrawable(photos[0]));
if (result >= -0.5 && result < 0)
img.setBackground(getResources().getDrawable(photos[1]));
if (result >= 0 && result < 0.5)
img.setBackground(getResources().getDrawable(photos[2]));
if (result >= 0.5)
img.setBackground(getResources().getDrawable(photos[3]));
}
}
Я получаю эту ошибку:
FAILURE: сборка не удалась, исключение.
Что пошло не так: выполнение задачи не выполнено: app: transformClassesWithDexForDebug. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: код возврата 1 для процесса dex
Попробуйте: Запустите с параметром --info или --debug, чтобы получить больше вывода журнала.
Исключение: org.gradle.api.tasks.TaskExecutionException: не удалось выполнить задачу ':app:transformClassesWithDexForDebug'. в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84) в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(at55).api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62) в org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute: ordleapigrag.tasks.execution..SkipTaskWithNoActionsExecuter.execute (SkipTaskWithNoActionsExecuter.java:51) в org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExternalT.Exas.Og.Tyg.Exa.TyGT.TyGT.SyTackSececuT.ExecuT. kExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) в org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) в org.gradle.exasTefTefGerTefGerTefKT.DK.java:236) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228) в org.gradle.internal.Transformers$4.transform(Transformers.java:169 at).internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) в org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61) в org.gradle.execution.taskgraphExGext.Ex ист Java: 228) в org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215) в org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77) в org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58Tex.TecasP.ExecTecutor.ecuT.ExsetTecutor.ecuk.paseTecutor.ect. 32) в org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113) в org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37ildexex.Exef..java:37) в org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) в org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) в org.gradle.executionExrytion.Dryun выполнить (DryRunBuildExecutionAction.java:32) в org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) в org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) в org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:196) в org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:193) в org.Transin. $ transform(Transformers.java:169) в org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) в org.gradle.internal.progress.DefaultBuildOperationExecutor.run (DefaultBuildOperationExecdle.ggra56).initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193) в org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119) в org.gradle.initialization.Defuncajrag gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71) в org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:50) в org.user пробег (ChainingBuildActionRunner.java:35) в org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:43) в org.gradle.nerAbBunder.unu java:40) в org.gradle.internal.Transformers$4.transform(Transformers.java:169) в org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106) в org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56) в org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40.un.un.ub SubscribeableBuildActionRunner.java:75) в org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) в org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41) в org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) в org.gradle.tooling.internal.provider.CecuinuousBuildActionEng.gradle..ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29) по адресу org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67) по адресу org.gradle.launcher.daexnildomecu.om (BuildCommandOnly.java:36) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) в org.gradle.launcher.daemon.server.exec.WatchForDisconnec. WatchDisconnec.).java:47) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) в org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecava: ResetDeprecation: 26) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) в org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStop:mon.jj) atj.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120) в org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) в org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) в org.gradle.util.Swapper.swap(Swapper.java:38) в org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) в org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) в org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java.20): launcher.daemon.server.exec.LogToClient.doBuild (LogToClient.java:60) в org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) в org.gradle.launcher.emon server.api.DaemonCommandExecution.proceed (DaemonCommandExecution.java:120) в org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild (EstablishBuildEnvironment.java:72) в org.gradle.launcver.c. BuildCommandOnly.execute (BuildCommandOnly.java:36) по адресу org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) по адресу org.gradle.launcher.daemon.BesignObRusRus.Ru.exe. (StartBuildOrRespondWithBusy.java:50) в org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297) в org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) в org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(исключение StoppableExecutorImpl.java:40): исключено: исключено: исключено: java.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: код возврата 1 для процесса dex по адресу com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55) в com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104) в com.android.build.gradle.internal.pipe.TransformTask.transform(TransformTask.java:176) по адресу org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) по адресу org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoSktectional ($). DefaultTaskClassInfoStore.java:163) в org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134) по адресу org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123).exeTec.executeAction(ExecuteActionsTaskExecuter.java:95) в org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76) ... еще 78 причин: com.android.build.apT.formExform: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: код возврата 1 для процесса dex на com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:453) на com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:185) на com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:181) на com.android.builder.profile.ThreadRecorder.re шнур (ThreadRecorder.java:102) ... еще 85 причин: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: код возврата 1 для процесса dex на com.android.builder.core.DexByteCodeConverter.dexInProcess(DexByteCodeConverter.java:180) на com.android.builder.core.DexByteCodeConverter.runDexer(DexByteCodeConverter.java:roid. combuilder.jav:158 at com.DexByteCodeConverter.convertByteCode(DexByteCodeConverter.java:143) в com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1345) в com.android.build.gradle.internalTransformexex:279) ... еще 88 Вызвано: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: код возврата 1 для процесса dex на com.android.builder.core.DexByteCodeConverter.dexInProcess(DexByteCodeConverter.java:178) ... еще 92 Причина: com.android.ide.common.process.ProcessException: код возврата 1 для процесса dex на com.android.builder.internal.compiler.DexWrapper$DexProcessResult.assertNormalExitValue(DexWrapper.java:117) на com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexB1): код
Это мой gradle.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
dexOptions {
incremental true
preDexLibraries = false
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.aso.mdasa.mdasa"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
compileOptions.encoding = 'UTF8'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
compile files('libs/jython-standalone-2.7.0.jar')
}
а это мой gradle.properties:
ject-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4608M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true