termux / termux-widget

Termux add-on app which adds shortcuts to commands on the home screen.
https://f-droid.org/en/packages/com.termux.widget
Other
1k stars 117 forks source link

com.termux.widget:style/Theme.MaterialComponents.DayNight.TermuxPrimaryActivity not found in local build #83

Closed timehlers closed 2 years ago

timehlers commented 2 years ago

Problem description

local build without downloaded "com.termux.termux-app:termux-shared:f3ffc36bfd" fails with error:

tehlers@local:~/termux/termux-widget> ./gradlew build
> Task :app:processReleaseResources FAILED
> Task :app:processDebugResources FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     ERROR:/home/tehlers/termux/termux-widget/app/build/intermediates/packaged_manifests/release/AndroidManifest.xml:39: AAPT: error: resource style/Theme.MaterialComponents.DayNight.TermuxPrimaryActivity (aka com.termux.widget:style/Theme.MaterialComponents.DayNight.TermuxPrimaryActivity) not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     ERROR:/home/tehlers/termux/termux-widget/app/build/intermediates/packaged_manifests/debug/AndroidManifest.xml:40: AAPT: error: resource style/Theme.MaterialComponents.DayNight.TermuxPrimaryActivity (aka com.termux.widget:style/Theme.MaterialComponents.DayNight.TermuxPrimaryActivity) not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
54 actionable tasks: 4 executed, 50 up-to-date

Steps to reproduce

I have patched this to make the build completely local:

tehlers@PCEHLERS-DELL:~/termux/t> diff -urN ori local
diff -urN ori/termux-app/app/build.gradle local/termux-app/app/build.gradle
--- ori/termux-app/app/build.gradle     2022-07-08 17:01:01.291835893 +0200
+++ local/termux-app/app/build.gradle   2022-07-08 11:33:33.745028076 +0200
@@ -111,7 +111,10 @@
     }

     lintOptions {
-        disable 'ProtectedPermissions'
+       disable 'ProtectedPermissions'
+        checkReleaseBuilds false
+        //If you want to continue even if errors found use following line
+        abortOnError false
     }

     testOptions {
diff -urN ori/termux-app/settings.gradle local/termux-app/settings.gradle
--- ori/termux-app/settings.gradle      2022-07-08 17:01:01.295835911 +0200
+++ local/termux-app/settings.gradle    2022-07-08 16:54:55.638195147 +0200
@@ -1 +1 @@
-include ':app', ':termux-shared', ':terminal-emulator', ':terminal-view'
+include ':app', ':termux-shared', ':terminal-emulator', ':terminal-view', ':termux-am-library'
diff -urN ori/termux-app/terminal-emulator/build.gradle local/termux-app/terminal-emulator/build.gradle
--- ori/termux-app/terminal-emulator/build.gradle       2022-07-08 17:01:01.295835911 +0200
+++ local/termux-app/terminal-emulator/build.gradle     2022-07-08 11:37:57.922017620 +0200
@@ -27,6 +27,12 @@
         }
     }

+    lintOptions {
+        checkReleaseBuilds false
+        //If you want to continue even if errors found use following line
+        abortOnError false
+    }
+
     externalNativeBuild {
         ndkBuild {
             path "src/main/jni/Android.mk"
diff -urN ori/termux-app/terminal-view/build.gradle local/termux-app/terminal-view/build.gradle
--- ori/termux-app/terminal-view/build.gradle   2022-07-08 17:01:01.295835911 +0200
+++ local/termux-app/terminal-view/build.gradle 2022-07-08 11:37:39.217949815 +0200
@@ -22,6 +22,12 @@
         }
     }

+    lintOptions {
+        checkReleaseBuilds false
+        //If you want to continue even if errors found use following line
+        abortOnError false
+    }
+
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
diff -urN ori/termux-app/termux-shared/build.gradle local/termux-app/termux-shared/build.gradle
--- ori/termux-app/termux-shared/build.gradle   2022-07-08 17:01:01.295835911 +0200
+++ local/termux-app/termux-shared/build.gradle 2022-07-08 16:55:34.126368412 +0200
@@ -27,7 +27,8 @@

         implementation project(":terminal-view")

-        implementation "com.termux:termux-am-library:v2.0.0"
+//        implementation "com.termux:termux-am-library:v2.0.0"
+       implementation project(path:":termux-am-library")
     }

     defaultConfig {
@@ -48,6 +49,12 @@
         }
     }

+    lintOptions {
+        checkReleaseBuilds false
+        //If you want to continue even if errors found use following line
+        abortOnError false
+    }
+
     compileOptions {
         // Flag to enable support for the new language APIs
         coreLibraryDesugaringEnabled true
diff -urN ori/termux-widget/app/build.gradle local/termux-widget/app/build.gradle
--- ori/termux-widget/app/build.gradle  2022-07-08 17:01:09.495872584 +0200
+++ local/termux-widget/app/build.gradle        2022-07-08 16:57:38.866928932 +0200
@@ -47,6 +47,12 @@
         targetCompatibility JavaVersion.VERSION_1_8
     }

+    lintOptions {
+        checkReleaseBuilds false
+        //If you want to continue even if errors found use following line
+        abortOnError false
+    }
+
     applicationVariants.all { variant ->
         variant.outputs.all { output ->
             if (variant.buildType.name == "debug") {
@@ -71,12 +77,13 @@
     implementation "androidx.annotation:annotation:1.2.0"
     implementation 'com.google.android.material:material:1.4.0'
     implementation "com.google.guava:guava:24.1-jre"
-    implementation 'com.termux.termux-app:termux-shared:f3ffc36bfd'
+//    implementation 'com.termux.termux-app:termux-shared:f3ffc36bfd'

     // Use if below libraries are published locally by termux-app with `./gradlew publishReleasePublicationToMavenLocal` and used with `mavenLocal()`.
     // If updates are done, republish there and sync project with gradle files here
     // https://github.com/termux/termux-app/wiki/Termux-Libraries
     //implementation 'com.termux:termux-shared:0.117'
+    implementation files('../../termux-app/termux-shared/build/outputs/aar/termux-shared-release.aar')
 }

 task versionName {

Then I build "termux-app", which builds and creates the shared file "termux-shared-release.aar", which I try to include in the "termux-widget" build.

My guess is, that the current version of "termux-shared" in "termux-app" is incompatible with "termux-widget", while the official file "com.termux.termux-app:termux-shared:f3ffc36bfd" is compatible.

I want to build termux completely without any dependencies by my own compile the app for a different function under another name...

Thanks

Tim

agnostic-apollo commented 2 years ago

My guess is, that the current version of "termux-shared" in "termux-app" is incompatible with "termux-widget", while the official file "com.termux.termux-app:termux-shared:f3ffc36bfd" is comp

Changes were made in theming after f3ffc36bfd. You can use Theme.BaseActivity.DayNight.DarkActionBar instead. I would suggest to roll back commits to f3ffc36bfd and then build/publish library if you cannot fix issues yourself created by using a higher termux-shared version, I don't have time to provide support for such issues. Or wait for me to update termux-widget to latest termux-shared version, whenever that happens.

https://github.com/termux/termux-app/wiki/Termux-Libraries#forking-and-local-development

https://github.com/termux/termux-app/commit/6631599f