Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,30 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.6.21'
ext {
agp_version1 = '8.6.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please just use agp_version instead of agp_version1.

agp_version = '8.0.0'
}
ext.kotlin_version = '1.8.22'
ext.koin_version = '2.1.6'
ext.lifecycle_version = '2.2.0'
ext.jacoco_core_version = '0.8.7'

repositories {
google()
mavenCentral()
maven { url "https://developer.huawei.com/repo/" }
gradlePluginPortal() // Required for Gradle plugins
}

dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "com.android.tools.build:gradle:$agp_version1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jacoco:org.jacoco.core:$jacoco_core_version"
classpath 'com.huawei.agconnect:agcp:1.4.2.300'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.51.0' // Add the plugin here
}
}

Expand All @@ -51,4 +58,13 @@ allprojects {
mavenCentral()
maven { url "https://developer.huawei.com/repo/" }
}

configurations.all {
resolutionStrategy {
force 'org.xerial:sqlite-jdbc:3.34.0'
}
}
}

// Apply the plugin explicitly to the root project
apply plugin: 'com.github.ben-manes.versions'
2 changes: 1 addition & 1 deletion catroid/gradle/code_quality_tasks.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ task pmd(type: Pmd) {

reports {
xml.required = true
html.enabled = false
html.required = false
xml.destination file("build/reports/pmd.xml")
}
}
Expand Down
1 change: 1 addition & 0 deletions catroid/src/catroid/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@

<resources>
<string name="app_name">Pocket Code</string>
<string name="project_id">""</string>
</resources>
4 changes: 4 additions & 0 deletions catroid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
<uses-permission android:name="android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS"
tools:ignore="ProtectedPermissions" />

<!-- custom media picker -->
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />

<!-- gps -->
<uses-feature
android:name="android.hardware.location.gps"
Expand Down Expand Up @@ -92,6 +95,7 @@
android:icon="${appIcon}"
android:label="${appName}"
android:theme="@style/Catroid"
tools:targetAPI="34"
android:supportsRtl="true"
android:requestLegacyExternalStorage="false"
tools:ignore="UnusedAttribute"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public void startCastService(final AppCompatActivity activity) {
intent,PendingIntent.FLAG_IMMUTABLE);
} else {
notificationPendingIntent = PendingIntent.getActivity(activity, 0,
intent, 0);
intent, PendingIntent.FLAG_IMMUTABLE);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
pendingIntent = PendingIntent.getActivity(getActivity(), 0, nfcIntent, PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(getActivity(), 0, nfcIntent, 0);
pendingIntent = PendingIntent.getActivity(getActivity(), 0, nfcIntent, PendingIntent.FLAG_IMMUTABLE);
}

if (nfcAdapter != null && !nfcAdapter.isEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ fun <T> LiveData<T>.getOrAwaitValue(
var data: T? = null
val latch = CountDownLatch(1)
val observer = object : Observer<T> {
override fun onChanged(o: T?) {
data = o
override fun onChanged(value: T) {
data = value
latch.countDown()
this@getOrAwaitValue.removeObserver(this)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private NotificationData createAndShowUploadNotification(Context context, String
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(context, notificationId,
uploadIntent, PendingIntent.FLAG_CANCEL_CURRENT);
uploadIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
}

NotificationData data = new NotificationData(R.drawable.ic_stat, programName,
Expand Down Expand Up @@ -242,7 +242,7 @@ public Notification createUploadRejectedNotification(Context context, int status
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
} else {
pendingIntent = PendingIntent.getActivity(context, notificationId,
openIntent, PendingIntent.FLAG_CANCEL_CURRENT);
openIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
}

builder.setContentIntent(pendingIntent);
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ android.useAndroidX=true
android.enableJetifier=true

org.gradle.caching=false
android.nonTransitiveRClass=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our app is basically a single module app, so we do not need to switch this off. If we migrate our app to a multi module architecture, it will significantly improve the build process if this is set to true, which happens by default.

android.nonFinalResIds=false
android.enableResourceValidation=false
Copy link
Contributor

@dorianpercic dorianpercic Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to enable this because, although the build process succeeds, missing R values are only checked at runtime, which can lead to bugs.
If this line is removed again, build failures occur. From what I have seen, these failures are related to missing resources caused by the removal of WebView components. You should be able to remove the affected code, but please double-check. :)


4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 09 18:08:52 CEST 2023
#Fri Jan 10 11:36:51 CET 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists