Apps build failed after upgrading AGP to 7.3.1

Description
Hi, I’ve encountered an issue when creating an apps with AGP version 7.3.1, Kotlin version 1.7.0 and using latest Zoom Meeting SDK. It throws error :

Execution failed for task ':app:shrinkBenchmarkRes'.
> A failure occurred while executing com.android.build.gradle.internal.transforms.ShrinkProtoResourcesAction
   > ParseError at [row,col]:[1,1]
     Message: Content is not allowed in prolog.

It’s only happen when I tried to set shrinkResources true

Which Android Meeting SDK version?
v5.13.1.11014

To Reproduce
Steps to reproduce the behavior:

  1. Create a new android project with AGP version 7.3.1
  2. Add Zoom Meeting SDK
  3. Set shrinkResources true in your build types
  4. Then try to run/build the apps. It will throw an error as I mentioned above.

Hi @wildhan ,

Thank you for your post here in the forum. The error you’re getting may be because of the wrong file format. To be sure, could you check the following points to make sure the settings are correct:

-Was ‘minifyEnabled: true’ added to your build.grable?
-Was your progaurd file in the correct format?

Thanks,
Rehema

Hi @rehema.zoom, yes already included that one.

benchmark {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.debug
            debuggable false
        }

I also tried using Zoom Sample Apps(bundled when download meeting SDK) update the AGP to 7.3.1 then modify build type to :

minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'

Proguard :

-keep class  us.zoom.**{*;}
-keep class  com.zipow.**{*;}
-keep class  us.zipow.**{*;}
-keep class  org.webrtc.**{*;}
-keep class  us.google.protobuf.**{*;}
-keep class  com.google.crypto.tink.**{*;}
-keep class  androidx.security.crypto.**{*;}

I still got the error :

Execution failed for task ':sample:shrinkDebugRes'.
> A failure occurred while executing com.android.build.gradle.internal.transforms.ShrinkProtoResourcesAction
   > ParseError at [row,col]:[1,1]
     Message: Content is not allowed in prolog.

Hello @wildhan ,

Would you please try to upgrade the meeting SDK version to 5.13.5? We’ve just published it yesterday and I tested it with shrinkResources true which works fine.
Thank you

Elaine

Thanks, @elaine.ku for the update, but I still encountered the problem using SDK version 5.13.5.11583. I might be missed something. I still test using the sample project mobile-rtc-android-studio and here’s my patch :

Index: example2/src/main/java/us/zoom/sdkexample2/Constants.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/example2/src/main/java/us/zoom/sdkexample2/Constants.java b/example2/src/main/java/us/zoom/sdkexample2/Constants.java
--- a/example2/src/main/java/us/zoom/sdkexample2/Constants.java	(revision 5a2d6548e9a3f7331273474bb4543121350c0151)
+++ b/example2/src/main/java/us/zoom/sdkexample2/Constants.java	(date 1674630498313)
@@ -24,6 +24,6 @@
      *     "tokenExp": long // token expire time
      * }
      */
-    public final static String SDK_JWTTOKEN = YOUR JWTTOKEN;
+    public final static String SDK_JWTTOKEN = "";
 
 }
Index: gradle/wrapper/gradle-wrapper.properties
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>ISO-8859-1
===================================================================
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
--- a/gradle/wrapper/gradle-wrapper.properties	(revision 5a2d6548e9a3f7331273474bb4543121350c0151)
+++ b/gradle/wrapper/gradle-wrapper.properties	(date 1674628728007)
@@ -3,4 +3,4 @@
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
Index: sample/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/sample/build.gradle b/sample/build.gradle
--- a/sample/build.gradle	(revision 5a2d6548e9a3f7331273474bb4543121350c0151)
+++ b/sample/build.gradle	(date 1674630449474)
@@ -21,11 +21,13 @@
     buildTypes {
         release {
             minifyEnabled true
+            shrinkResources true
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
         }
 
         debug {
             minifyEnabled true
+            shrinkResources true
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
         }
 
Index: build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/build.gradle b/build.gradle
--- a/build.gradle	(revision 5a2d6548e9a3f7331273474bb4543121350c0151)
+++ b/build.gradle	(date 1674628880508)
@@ -9,7 +9,7 @@
         google()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:7.1.2'
+        classpath 'com.android.tools.build:gradle:7.3.1'
     }
 }
 

I did everything that you have done with the sample app and am still not able to reproduce the issue. However, I’ve found someone else facing the same issue as you. Would you please try to remove the blank line in the XML files that are in res/ folder?
Ex:
Change

<?xml version="1.0" encoding="utf-8"?>

<app name="" version="1.1">

To

<?xml version="1.0" encoding="utf-8"?>
<app name="" version="1.1">

and see whether this solves the issue. If it would be the root cause, I’ll check internally and update those XML files in the later release.

Still no luck, I’ve deleted the empty line. Actually, if I use AGP 8.0.0-beta01 it works, but I consider not upgrading to AGP 8 yet and waiting for stable version. I end up using AGP 7.4.0 and add this in gradle.properties

android.enableNewResourceShrinker=false

Seems like they have a bug in the new shrink method and fixed in Gradle 8. ref: Google Issue Tracker

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.