duplicate class HollywoodDelegate

Please post anything related to the Hollywood APK Compiler here
Post Reply
amyren
Posts: 441
Joined: Thu May 02, 2019 11:53 am

duplicate class HollywoodDelegate

Post 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?
amyren
Posts: 441
Joined: Thu May 02, 2019 11:53 am

Re: duplicate class HollywoodDelegate

Post 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"
User avatar
airsoftsoftwair
Posts: 5906
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: duplicate class HollywoodDelegate

Post by airsoftsoftwair »

Right, that's a bug of course. I'll provide a fix for this shortly. Thanks for reporting!
User avatar
airsoftsoftwair
Posts: 5906
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: duplicate class HollywoodDelegate

Post 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.
amyren
Posts: 441
Joined: Thu May 02, 2019 11:53 am

Re: duplicate class HollywoodDelegate

Post 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.
Post Reply