Replace fix for c++_shared conflicts

My previous work at this commit:
499641538e14b0874dc87493ece27608e4f550f6
would force developers to manually change their gradle files for this
release. We want to avoid that so this new fix keeps the behaviour
consitent with previous releases and removes JNI folder added when we
moved to the new build system.

Bug: n/a
Test: Ran samples
Change-Id: If26340b45852e8cb2628f5668c05cb333f802527
diff --git a/game-activity/build.gradle b/game-activity/build.gradle
index 8da7051..07c9fbe 100644
--- a/game-activity/build.gradle
+++ b/game-activity/build.gradle
@@ -57,13 +57,14 @@
         }
     }
 
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
+    // If we don't include this line the created .aar contains the c++ std lib
+    // at <.aar_file>/jni/<abi>/libc++_shared.so. When we have multiple
+    // libraries containing libc++_shared.so the linker complains because it
+    // can't choose between them. Because we use prefab we don't need to
+    // contents of the <.aar_file>/jni/* folder so we can just exclude it here
+    // to prevent the jni folder from being created.
     packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
+        exclude("**.so")
     }
 }
 
diff --git a/game-text-input/build.gradle b/game-text-input/build.gradle
index d47097e..edfdd57 100644
--- a/game-text-input/build.gradle
+++ b/game-text-input/build.gradle
@@ -57,13 +57,14 @@
         }
     }
 
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
+    // If we don't include this line the created .aar contains the c++ std lib
+    // at <.aar_file>/jni/<abi>/libc++_shared.so. When we have multiple
+    // libraries containing libc++_shared.so the linker complains because it
+    // can't choose between them. Because we use prefab we don't need to
+    // contents of the <.aar_file>/jni/* folder so we can just exclude it here
+    // to prevent the jni folder from being created.
     packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
+        exclude("**.so")
     }
 }
 
diff --git a/games-controller/build.gradle b/games-controller/build.gradle
index 84c6526..2811c66 100644
--- a/games-controller/build.gradle
+++ b/games-controller/build.gradle
@@ -76,13 +76,14 @@
         }
     }
 
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
+    // If we don't include this line the created .aar contains the c++ std lib
+    // at <.aar_file>/jni/<abi>/libc++_shared.so. When we have multiple
+    // libraries containing libc++_shared.so the linker complains because it
+    // can't choose between them. Because we use prefab we don't need to
+    // contents of the <.aar_file>/jni/* folder so we can just exclude it here
+    // to prevent the jni folder from being created.
     packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
+        exclude("**.so")
     }
 }
 
diff --git a/games-frame-pacing/build.gradle b/games-frame-pacing/build.gradle
index 33f9171..fc84306 100644
--- a/games-frame-pacing/build.gradle
+++ b/games-frame-pacing/build.gradle
@@ -73,13 +73,14 @@
         }
     }
 
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
+    // If we don't include this line the created .aar contains the c++ std lib
+    // at <.aar_file>/jni/<abi>/libc++_shared.so. When we have multiple
+    // libraries containing libc++_shared.so the linker complains because it
+    // can't choose between them. Because we use prefab we don't need to
+    // contents of the <.aar_file>/jni/* folder so we can just exclude it here
+    // to prevent the jni folder from being created.
     packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
+        exclude("**.so")
     }
 }
 
diff --git a/games-performance-tuner/build.gradle b/games-performance-tuner/build.gradle
index 8b175fa..e9183ae 100644
--- a/games-performance-tuner/build.gradle
+++ b/games-performance-tuner/build.gradle
@@ -77,13 +77,14 @@
         }
     }
 
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
+    // If we don't include this line the created .aar contains the c++ std lib
+    // at <.aar_file>/jni/<abi>/libc++_shared.so. When we have multiple
+    // libraries containing libc++_shared.so the linker complains because it
+    // can't choose between them. Because we use prefab we don't need to
+    // contents of the <.aar_file>/jni/* folder so we can just exclude it here
+    // to prevent the jni folder from being created.
     packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
+        exclude("**.so")
     }
 }
 
diff --git a/samples/agdktunnel/app/build.gradle b/samples/agdktunnel/app/build.gradle
index a65961c..a1dbaac 100644
--- a/samples/agdktunnel/app/build.gradle
+++ b/samples/agdktunnel/app/build.gradle
@@ -93,15 +93,6 @@
             enableSplit true
         }
     }
-
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
-    packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-    }
 }
 
 dependencies {
diff --git a/samples/bouncyball/app/build.gradle b/samples/bouncyball/app/build.gradle
index 6e7f271..0f75a69 100644
--- a/samples/bouncyball/app/build.gradle
+++ b/samples/bouncyball/app/build.gradle
@@ -38,15 +38,6 @@
     buildFeatures {
         prefab true
     }
-
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
-    packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-    }
 }
 
 allprojects {
diff --git a/samples/game_controller/gameactivity/app/build.gradle b/samples/game_controller/gameactivity/app/build.gradle
index 8107d09..8f3e88a 100644
--- a/samples/game_controller/gameactivity/app/build.gradle
+++ b/samples/game_controller/gameactivity/app/build.gradle
@@ -48,15 +48,6 @@
     buildFeatures {
         prefab true
     }
-
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
-    packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-    }
 }
 android.lintOptions {
         abortOnError  = false
diff --git a/samples/game_controller/nativeactivity/app/build.gradle b/samples/game_controller/nativeactivity/app/build.gradle
index cd3eac8..9a46fb7 100644
--- a/samples/game_controller/nativeactivity/app/build.gradle
+++ b/samples/game_controller/nativeactivity/app/build.gradle
@@ -48,15 +48,6 @@
     buildFeatures {
         prefab true
     }
-
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
-    packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-    }
 }
 android.lintOptions {
         abortOnError  = false
diff --git a/samples/game_text_input/game_text_input_testbed/app/build.gradle b/samples/game_text_input/game_text_input_testbed/app/build.gradle
index 4f230d8..b5d11e7 100644
--- a/samples/game_text_input/game_text_input_testbed/app/build.gradle
+++ b/samples/game_text_input/game_text_input_testbed/app/build.gradle
@@ -33,15 +33,6 @@
     buildFeatures {
         prefab true
     }
-
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
-    packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-    }
 }
 
 dependencies {
@@ -55,4 +46,4 @@
     //implementation fileTree(dir: '../../../../', include: ['game-text-input-release.aar'])
 
     implementation project(":game-text-input")
-}
\ No newline at end of file
+}
diff --git a/samples/tuningfork/experimentsdemo/app/build.gradle b/samples/tuningfork/experimentsdemo/app/build.gradle
index de11712..c5aecdc 100644
--- a/samples/tuningfork/experimentsdemo/app/build.gradle
+++ b/samples/tuningfork/experimentsdemo/app/build.gradle
@@ -34,15 +34,6 @@
     buildFeatures {
         prefab true
     }
-
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
-    packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-    }
 }
 
 dependencies {
diff --git a/samples/tuningfork/insightsdemo/app/build.gradle b/samples/tuningfork/insightsdemo/app/build.gradle
index 989e57b..a7a4c61 100644
--- a/samples/tuningfork/insightsdemo/app/build.gradle
+++ b/samples/tuningfork/insightsdemo/app/build.gradle
@@ -39,15 +39,6 @@
     buildFeatures {
         prefab true
     }
-
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
-    packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-    }
 }
 
 dependencies {
diff --git a/third_party/cube/app/build.gradle b/third_party/cube/app/build.gradle
index d70750d..6260dc7 100644
--- a/third_party/cube/app/build.gradle
+++ b/third_party/cube/app/build.gradle
@@ -54,15 +54,6 @@
     buildFeatures {
         prefab true
     }
-
-    // This fixes the "2 files found with path 'lib/arm64-v8a/libc++_shared.so'" error we get
-    // when compiling multiple libraries that depend on libc++_shared.so
-    packagingOptions {
-        pickFirst 'lib/x86/libc++_shared.so'
-        pickFirst 'lib/x86_64/libc++_shared.so'
-        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
-        pickFirst 'lib/arm64-v8a/libc++_shared.so'
-    }
 }
 
 dependencies {