Instant Apps - Error:org.gradle.process.internal.E

2019-02-19 18:48发布

问题:

I am trying to build my first instant app which was introduced in Google IO 2017. I have downloaded Google Instant Apps SDK and target minSDKVersion to 23

I created a first project and I am facing below errors while trying to build it. Is there anyone who is also facing same errors for building Instant apps ? Is this because of some bug in build process of them ?

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :base:generateDebugSources, :base:generateDebugAndroidTestSources, :base:mockableAndroidJar, :feature:generateDebugSources, :feature:mockableAndroidJar, :feature:generateDebugAndroidTestSources, :instantapp:generateDebugSources]

Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\williams\AppData\Local\Android\Sdk\build-tools\25.0.2\aapt2.exe with arguments {link -I C:\Users\williams\AppData\Local\Android\Sdk\platforms\android-25\android.jar --manifest C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\intermediates\manifest\androidTest\debug\AndroidManifest.xml -R @C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\intermediates\incremental\processDebugAndroidTestResources\aapt-temp\aapt-resources-list.txt --auto-add-overlay --java C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\generated\source\r\androidTest\debug -o C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\intermediates\res\androidTest\debug\resources-debugAndroidTest.ap_ -0 apk --output-text-symbols C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\intermediates\symbols\androidTest\debug\R.txt --no-version-vectors}

Error:com.android.ide.common.process.ProcessException: Error while executing process C:\Users\williams\AppData\Local\Android\Sdk\build-tools\25.0.2\aapt2.exe with arguments {link -I C:\Users\williams\AppData\Local\Android\Sdk\platforms\android-25\android.jar --manifest C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\intermediates\manifest\androidTest\debug\AndroidManifest.xml -R @C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\intermediates\incremental\processDebugAndroidTestResources\aapt-temp\aapt-resources-list.txt --auto-add-overlay --java C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\generated\source\r\androidTest\debug -o C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\intermediates\res\androidTest\debug\resources-debugAndroidTest.ap_ -0 apk --output-text-symbols C:\Users\williams\AndroidStudioProjects\InstantAppDemo\base\build\intermediates\symbols\androidTest\debug\R.txt --no-version-vectors}

Error:org.gradle.process.internal.ExecException: Process 'command 'C:\Users\williams\AppData\Local\Android\Sdk\build-tools\25.0.2\aapt2.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':base:processDebugAndroidTestResources'.
> Failed to execute aapt
Information:BUILD FAILED in 3s
Information:4 errors
Information:0 warnings
Information:See complete output in console

回答1:

To build your instant apps, you should use build-tools\26.0.0-rc1 and above. It looks like you are using 25.0.2.



回答2:

Set up a development environment for Android Instant Apps

To develop an instant app, you need the following:

  • A development machine running Linux, macOS, or Windows.
  • JDK 1.8
  • Android Studio 3.0 or higher -An environment variable called ANDROID_HOME that points to the location of the Android SDK on your development machine.

    In Android Studio, use the Android SDK Manager to install the following packages:

  • Android SDK 6.0 or higher

  • Android SDK Build Tools 26.x or higher
  • Android SDK Tools 25.x or higher
  • Android SDK Platform Tools 25.x or higher
  • Android Support Library (latest) Android Repository (latest)

    Reference


回答3:

I have been working with 3.1 Canary2 on a Project I am about to modularize to Instant and Installed. I updated the versions to the latest of the list above and set the environment value, but adb would not initialize. So I updated to Canary6, which then required another Gradle upgrade. Then the classpath had to be manually updated to alpha06. After that I got a clean Build but running in emulator failed with "qemu-system-i386.exe has stopped working". I installed V6.2.1 of Intel x86 Emulator Accelerator. What do I do now?

I had been working with the Topeka sample code and thought there might be some inconsistency with all the version upgrades. So I reverted to the copy of my Project instead. But now that application installation failed with "Could not access the Package Manager ... uninstall it?"

A couple more tries and discovered that the (sole) activity was not accessible. As soon as I changed the directory name in the path, which was a leftover from having made this test copy of the Project, Gradle built, the APK loaded, and all is right.

Whew! Hope this helps others.