[Android Software Development] mybeshoo:
Please note the error I reported in the next post, it is not as same as the first one.

I search the github.com. i found this

https://github.com/DexPatcher/dexpatcher-gradle/issues/26

And I tested APKTOOL against Instagram it works as expected and I can do d& b.

---------- Post added at 03:54 AM ---------- Previous post was at 03:47 AM ----------

I am not sure if this problem related to APKTOOL "--only-main-classes" base on

https://github.com/iBotPeaches/Apktool/issues/2247

Anyway, I just tested with apkTool "dexpatcher-repo.ibotpeaches.apktool:apktool:2.4.1"..

and have this again

Android resource compilation failed
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:78: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:79: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:80: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:81: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:82: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:83: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:84: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:85: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:86: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:87: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:88: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:89: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:90: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:91: error: invalid value for type 'attr'. Expected a reference.

---------- Post added at 04:12 AM ---------- Previous post was at 03:54 AM ----------

Since Instagram has 3 dex files I add

apply plugin: 'com.github.lanchon.dexpatcher.patched-application'

dexpatcherConfig {
patchedApplication {
printAppInfo = true;

// Enabling the following settings makes the Android build system tolerant of some
// types of invalid resources, such as file-based resources that have invalid names.

// Disable detection of invalid resources and attempt to process them normally.
// Defaults to false.
disableResourceValidation = true

// Build the patched app using a custom AAPT2 binary bundled with the version of
// Apktool currently in use. These AAPT2 binaries are modified to allow rebuilding
// of slightly out-of-spec apps, such as apps that contain invalid resources.
// Defaults to false.
useAapt2BundledWithApktool = true

}

dexpatcher {
verbosity = VERBOSE
multiDex = true
multiDexThreaded = true
multiDexJobs = 8
}
}

android {
compileSdkVersion 21
//buildToolsVersion '28.0.3'

defaultConfig {
// The 'package' attribute in the patched app manifest must be different from the
// source app ID to support class generation (R and BuildConfig), but here you can
// override the exported patched app ID to match the source.
applicationId 'makeinfo.com.getid'

// You must set these fields to match or be compatible with the corresponding data
// of the source app. (Data is displayed when the source apk library is built.)
minSdkVersion 9
targetSdkVersion 28
versionCode 1
versionName '1.0'
}

lintOptions {
disableLintTasks true
//checkReleaseBuilds false
}
}

dependencies {
// We import an Android library, a file chooser, just for fun. This pulls in all its
// resources that will be transparently merged, like other resources from this project,
// with those of the source app. Each component will have its own independent 'R' class.
// The numeric IDs of the resources coming from the source app will be kept constant.
implementation('ru.bartwell:exfilepicker:1.8') {
// But the imported library has a transitive dependency on a module that is already
// present in the source app. So we exclude it from the import, keeping the source
// app's version. Alternatively we could delete the copy brought in by the source
// app using DexPatcher package annotations.
exclude module: 'support-v4'
}
}

void disableLintTasks(boolean disableTasks) {
if (disableTasks) {
tasks.withType(com.android.build.gradle.tasks.LintBaseTask).configureEach {
enabled = false
}
}
}

But still have the resource error

Android resource compilation failed
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:78: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:79: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:80: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:81: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:82: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:83: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:84: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:85: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:86: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:87: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:88: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:89: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:90: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:91: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:92: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:93: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:94: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:95: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:96: error: invalid value for type 'attr'. Expected a reference.
C:\Users\DELL\AndroidStudioProjects\dexpatcher-gradle-samples\invalid-resources\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:97: error: invalid value for type 'attr'. Expected a reference.

APKtool Settings

buildscript {
repositories {
google()
jcenter()
}
dependencies {
// Android Gradle plugins:
classpath 'com.android.tools.build:gradle:3.4.2'
}
}

buildscript {
repositories {
gradlePluginPortal()
// This is the local repo I use for plugin development, you should remove it:
flatDir dirs: '../../dexpatcher-gradle/build/libs'
}
dependencies {
// DexPatcher Gradle plugins:
classpath 'com.github.lanchon.dexpatcher:dexpatcher-gradle:2.0.0'
}
}

allprojects {
repositories {
google()
jcenter()
}
}

allprojects {
repositories {
// DexPatcher repo (https://dexpatcher.github.io/dexpatcher-repo/)
maven { url 'https://dexpatcher.github.io/dexpatcher-repo/m2' }
// This is the local repo I use for tool development, you should remove it:
flatDir dirs: rootProject.file('../../dexpatcher-tool/tool/build/libs')
}
dependencies {
configurations.all {
switch (name) {
case 'apktool':
add name, 'dexpatcher-repo.ibotpeaches.apktool:apktool:2.4.1'
break
case 'dex2jar':
add name, 'dexpatcher-repo.dexpatcher.dex2jar:dex-tools:2.1-20171001-lanchon@zip'
break
case 'dexpatcher':
add name, 'dexpatcher-repo.dexpatcher.dexpatcher-tool:dexpatcher:1.7.0'
break
case 'dexpatcherAnnotation':
// By default the annotation package bundled within DexPatcher tool is used.
//add name, 'dexpatcher-repo.dexpatcher.dexpatcher-tool:dexpatcher-annotation:?'
break
case 'aapt2':
// By default the AAPT2 binary provided by the Android Gradle plugin is used
// (unless 'useAapt2BundledWithApktool' is set to true in the build script).
//add name, 'dexpatcher-repo.ibotpeaches.apktool:apktool-aapt2:?'
//add name, 'com.android.tools.build:aapt2:?:linux|windows|osx'
//add name, rootProject.files('aapt2/linux|windows|macosx/aapt2[.exe]')
break
}
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Which point to

<item name="APKTOOL_DUMMY_1" type="attr">false</item>