New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fail with Android Studio 3.0 #27

Closed
IvanBean opened this Issue Oct 26, 2017 · 19 comments

Comments

Projects
None yet
8 participants
@IvanBean

IvanBean commented Oct 26, 2017

Hi,
I encounter an error unknown element <library> found when compiling this library with Android Studio 3.0 released today and gradle 3.0.0. Screenshot: https://imgur.com/a/qcy5e

Dependencies as below, only default implementation and face 1.3.0.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:26.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    implementation 'com.microsoft.projectoxford:face:1.3.0'
}

Any reply will be appreciated. Thanks!

@huxuan

This comment has been minimized.

Contributor

huxuan commented Oct 26, 2017

It sounds like a back-compatibility problem of Android Studio. We will keep this issue open until problem solved. Thanks for your reporting.

@IvanBean

This comment has been minimized.

IvanBean commented Oct 27, 2017

Hi huxuan,

Thanks for the reply.

After some research I found document mention gradle 3.0.0 will throw an error instead of ignoring the unknown tag, maybe we can fix this by removing the <library> tag in ClientLibrary's Androidmanifest. Here's another library fix this issue before by removing it.

Thanks!

@huxuan

This comment has been minimized.

Contributor

huxuan commented Oct 27, 2017

Hi @IvanBean,

Thanks for prompt response and the valuable information.
We will look into it and come back with actual actions.

Bests,
Sean.

@mgjo5899

This comment has been minimized.

mgjo5899 commented Oct 30, 2017

I faced the same issue. Is there a temporary solution for this to work?

@huxuan

This comment has been minimized.

Contributor

huxuan commented Oct 31, 2017

Hi @IvanBean @mgjo5899, so you guys are trying to build and run the Android Sample? If that is the case, you do not need any code changes, just run it. The README may be a little misleading, we will consider to change that in the next release. Another kind reminder is that we should never add com.microsoft.projectoxford in ClientLibrary's dependencies. Just run the sample as it is.

@IvanBean

This comment has been minimized.

IvanBean commented Oct 31, 2017

Hi @huxuan,
I think the main reason is Gradle 3.0.0 don't accept <library> tag, if we run the Android Sample with Gradle 2.3.x then it works fine, but with Gradle 3.0.0 I had tried Android Sample, our current project, and new empty project, the results are the same as first post's screenshot.

Hi @mgjo5899, for now, I downgrade Gradle to 2.3.3 to keep project compilable.

Thanks!

@JunjieCheng

This comment has been minimized.

JunjieCheng commented Nov 2, 2017

I got the same issue in my App, but the sample works fine.

@huxuan

This comment has been minimized.

Contributor

huxuan commented Nov 3, 2017

Hi everybody, thanks for your report and effort.

Currently, @IvanBean 's solution should be a temporarily fix.

We are already in a cycle of new release. We will ensure the new released version works fine with latest Android Studio and Gradle. Please be a little patient as there is no promise on the exact release date.

I will keep this issue open until the new version is finally public released.

@tonystark11

This comment has been minimized.

tonystark11 commented Jan 4, 2018

Hi everybody, I was having the same issue with Android Studio 3.0.1 and Gradle version 4.1. I tried downgrading Gradle to lower versions, like 2.3.3 and others. But, it led to other compatibility problems. I went on fixing each problem one-by-one, resulting in a really messed up Gradle configuration with no success.
Finally, I reverted all my changes and added the line android.enableAapt2=false to the gradle.properties file so as to avoid using aapt2 as it has become more restrictive. This might be a temporary solution for those who want to use this API till the issue is not fixed.

@huxuan

This comment has been minimized.

Contributor

huxuan commented Mar 1, 2018

The SDK and Sample should support Android Studio 3.0.1 and Gradle version 4.1 now.

Close this issue and feel free to create a new one if you have any concern.

@huxuan huxuan closed this Mar 1, 2018

@ptedeschi

This comment has been minimized.

ptedeschi commented Apr 10, 2018

Still happening on Android Studio 3.1.1 with Gradle 4.4

implementation 'com.microsoft.projectoxford:face:1.4.1'
error: unknown element found

@vernazza

This comment has been minimized.

Contributor

vernazza commented Apr 10, 2018

You have to add
android.enableAapt2=false
in your gradle properties.

This will disable aapt2; to avoid that I forked the repository just to remove the unused element that is present in the manifest

@huxuan

This comment has been minimized.

Contributor

huxuan commented Apr 10, 2018

Hi Buddies, I think enableAapt2 is set to false in current latest code base as a temporarily solution.
If you guys have any better proposal, any instructions or even pull requests are welcome!

@ptedeschi

This comment has been minimized.

ptedeschi commented Apr 10, 2018

Adding android.enableAapt2=false causes java.util.NoSuchElementException

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexWithInstantRunDependenciesApkForDebug'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: Failed to execute aapt
	at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
	at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	... 32 more
Caused by: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: Failed to execute aapt
	at com.android.build.gradle.internal.transforms.InstantRunDependenciesApkBuilder.transform(InstantRunDependenciesApkBuilder.java:152)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
	... 48 more
Caused by: com.android.ide.common.process.ProcessException: Failed to execute aapt
	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:809)
	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:797)
	at com.android.build.gradle.internal.transforms.InstantRunSplitApkBuilder.generateSplitApkResourcesAp(InstantRunSplitApkBuilder.java:375)
	at com.android.build.gradle.internal.transforms.InstantRunSplitApkBuilder.generateSplitApkResourcesAp(InstantRunSplitApkBuilder.java:323)
	at com.android.build.gradle.internal.transforms.InstantRunSplitApkBuilder.generateSplitApk(InstantRunSplitApkBuilder.java:211)
	at com.android.build.gradle.internal.transforms.InstantRunDependenciesApkBuilder.transform(InstantRunDependenciesApkBuilder.java:149)
	... 51 more
Caused by: java.util.NoSuchElementException
	at com.google.common.collect.AbstractIndexedListIterator.next(AbstractIndexedListIterator.java:80)
	at com.google.common.collect.Iterators.getOnlyElement(Iterators.java:315)
	at com.google.common.collect.Iterables.getOnlyElement(Iterables.java:263)
	at com.android.builder.internal.aapt.v1.AaptV1.makePackageProcessBuilder(AaptV1.java:202)
	at com.android.builder.internal.aapt.AbstractProcessExecutionAapt.makeValidatedPackage(AbstractProcessExecutionAapt.java:67)
	at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:34)
	at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:807)
	... 56 more
@IvanBean

This comment has been minimized.

IvanBean commented Apr 10, 2018

Hello, instead of disabling aapt2, I think simply remove <library> tag can fix this. Thanks to @vernazza who already done it as PR #34.

@huxuan

This comment has been minimized.

Contributor

huxuan commented Apr 10, 2018

Cool. Thanks for you guys' efforts! I have merged the pull request and will update the package release soon.

@huxuan huxuan referenced this issue Apr 11, 2018

Closed

about #35

@huxuan

This comment has been minimized.

Contributor

huxuan commented Apr 12, 2018

Version 1.4.2 is released by fixing those issues.
Thanks for your guys' efforts,

@huxuan

This comment has been minimized.

Contributor

huxuan commented May 22, 2018

Hi Sunny, SpeakerRecognition belongs to a different team from us. But since the Android SDK is open source, you can just refer to the changes in Face SDK here and apply it to SpeakerRecognition by yourself.
Just let me know if you need any further help.

@Sunny-NEU

This comment has been minimized.

Sunny-NEU commented May 22, 2018

@huxuan Thank you very much. I just tried to delete the library element in the AndroidMainfest of ClientLibrary and rebuild it. it seems work fine. I appreciate guys' solutions, and your team is great compared to the other team.Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment