Page 1 of 1

duplicate class HollywoodDelegate

Posted: Mon Feb 16, 2026 1:11 pm
by amyren
With apk compiler 5.0 I get this error when compiling
C:\Users\Admin\AppData\Local\AirsoftSoftwair\APKCompiler\com.amy66dev.dirtest\app\src\main\java\HollywoodDelegate.java:29: error: duplicate class: com.amy66dev.dirtest.HollywoodDelegate
public class HollywoodDelegate extends HollywoodActivity {

WHen browsing the project structure created by the compiler there are created two versions of the HollywoodDelegate.java file.

app/src/main/java/com/amy66dev/dirtest/HollywoodDelegate.java
app/src/main/java/HollywoodDelegate.java

I this corrrect?

Re: duplicate class HollywoodDelegate

Posted: Mon Feb 16, 2026 9:19 pm
by amyren
Before coming as far as to the point I got that duplicate error, there was some other errors reported.
To get past those I had to use a custom gradle.build script like this

Code: Select all

plugins {
    alias(libs.plugins.android.application)
}

android {
    namespace = '%PACKAGE%'
    compileSdk {
        version = release(%COMPILESDK%)
    }

    defaultConfig {
        applicationId "%PACKAGE%"
        minSdk %MINSDK%
        targetSdk %TARGETSDK%

        versionCode %VERSIONCODE%
        versionName "%VERSION%"
	
        ndk {
            abiFilters "armeabi-v7a", "arm64-v8a"
        }
    }

    buildFeatures {
        viewBinding = true
    }
    
    lint {
        disable.add("Instantiatable")    
	abortOnError = false	
    }
    
    signingConfigs {
        release {
            storeFile file("%KEYSTORE%")
            storePassword "%KEYSTOREPWD%"
            keyAlias "%KEYALIAS%"
            keyPassword "%KEYALIASPWD%"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig = signingConfigs.release  	    
        }
    }      
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    
    sourceSets {
        main {
            java.srcDirs = ['src/main/java']         
        }
    } 
    
    externalNativeBuild {
        cmake {
            path "src/main/cpp/CMakeLists.txt"
        }
    }

    ndkVersion = "%NDKVERSION%"    
}

dependencies {
    implementation libs.appcompat
    implementation libs.androidx.documentfile
}
After that I got that duplicate HollywoodDelegate.java error.

Now, for testing I did try to rename my HollywoodDelegate.java into MyHollywoodDelegate.java, and also changed that in the java file itself

Code: Select all

public class MyHollywoodDelegate extends HollywoodActivity {

    private static final String TAG = "MyHollywoodDelegate";
Now it compiles with success, but the apk itself will fail as soon as it tries to use CallJavaMethod to call any of my own functions.
"Java method 'xxx' not found"

Re: duplicate class HollywoodDelegate

Posted: Thu Feb 19, 2026 9:16 pm
by airsoftsoftwair
Right, that's a bug of course. I'll provide a fix for this shortly. Thanks for reporting!

Re: duplicate class HollywoodDelegate

Posted: Sun Feb 22, 2026 11:53 am
by airsoftsoftwair

Code: Select all

- Fix: Using custom code was broken
Fixed and Hollywood APK Compiler 5.1 has just been released so everything should be working again now.

Re: duplicate class HollywoodDelegate

Posted: Sun Feb 22, 2026 9:48 pm
by amyren
Wonderful, now its working again.

Although I had to rename one of my entries in my HollywoodDelegate.java to avoid conflict.
I guess there are "competing" CalljavaMethod commands now.

I had my own java command named createFile, and that resulted in compile errors.
To resolve this I had to rename my createFile to something else.

Now I guess I should find myself a renaming scheme, like for functions where we add the "p_" to the function name to avoid conflicts.
Any recommandations for this matter?

Also I wonder if there are many of these inbuilt calljavaMethod commands now.

Re: duplicate class HollywoodDelegate

Posted: Sun Mar 01, 2026 6:11 pm
by airsoftsoftwair
amyren wrote: Sun Feb 22, 2026 9:48 pm Any recommandations for this matter?
The Hollywood APK Compiler manual says the following...
Note that all your sources should use a prefix like "My" to avoid clashes with inbuilt Hollywood classes, e.g. use "MyCoolClass" instead of "CoolClass". Then you should be on the safe side.
...but using "p_" or something should also be reasonably safe.
amyren wrote: Sun Feb 22, 2026 9:48 pm Also I wonder if there are many of these inbuilt calljavaMethod commands now.
Even if there are, they are all internal so you should not try to make any assumptions about those because they can change all the time...