CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Jun 2021
    Posts
    5

    IllegalAccessError, cannot acces class

    Please, I am using AIDE IDE on android with libgdx and everything was okay until I got error message:
    Code:
    06-25 22:38:02.730 14459 14484 E   AndroidRuntime                ava.lang.IllegalAccessError: 
                   jIllegal class access ('com.hmmmgames.dungroll.DungeonRollcall' attempting to access 'com.hmmmgames.dungroll.creatures.Creature') 
                   jin attempt to invoke virtual method java.lang.String com.hmmmgames.dungroll.creatures.Creature.myid() 
                   j(declaration of 'com.hmmmgames.dungroll.DungeonRollcall' appears in /data/app/com.hmmmgames.dungroll-1/base.apk)
    
    06-25 22:38:02.730 14459 14484 E   AndroidRuntime                               at com.hmmmgames.dungroll.DungeonRollcall.add(DungeonRollcall.java:102)
    Please, how do I fix?

    Creature.java(summarized)
    Code:
    class Creature
    {
        public static class Action {
            public String name;
            
        }
    
        public static final int ME = -1;
        public static final int MY_CLAN_FRIEND = 1;
        public static final int MY_FOREIGN_FRIEND = 2;
        public static final int MY_CLAN = 3;
        public static final int MY_CLAN_ALLY = 4;
        public static final int UNKNOWN_CREATURE = 5;
        public static final int UNKNOWN_CLAN = 6;
        public static final int MY_CLAN_ENEMY = 7;
        public static final int MY_FOREIGN_ENEMY = 8;
        public static final int ENEMY_CLAN = 9;
        public static final int TOTAL_TARGETS = 9;
        
        
        public Map<String, Double> stats;
        public Map<String, Double> liking;
        //holds knowledge of what each creature is doing
        //can be outdated... that's the fun :P.
        //Some may choose to tell you knowledge or not.
        public Map<String, String> knowledge;
        
        public String name;
        
        public ClanWrap clan;
        public GroupWrap group;
        public GroupWrap previousGroup;
        
        public CreatureWrap target;
        public boolean toKill = false;
        public boolean isFighting = false;
        public boolean retreating = false;
        public double startingEnemyHealth;
        //use this to find action of creature
        //creature.name+action
        public String action;
        
        public int rampageTime = 0;
        public int regard = 0;
        public double startingHealth = 0;
        public String currentAction = "";
        public String pendingAction = "";
        
        public DungeonRoomWrap currentRoom;
        public ArrayList<Clan.Surname> bloodline;
        private double movingProgress;
        
        public static String[] tactical = {"wisdom","patience","sanity"};
        
        public boolean played = false;
        private String uuid;
    	
    	public String myid() {
    		return uuid;
    	}
        
        public Creature(Group parentGroup) {
            group = new GroupWrap(parentGroup);
            clan = new ClanWrap(group.get().clan.get());
            liking = new HashMap<>();
            bloodline = new ArrayList<>();
            stats = new HashMap<>();
            knowledge = new HashMap<>();
            
            uuid = DungeonRollcall.uuid();
            DungeonRollcall.add(this);
            
            
        }
    DungeonRollcall.java
    Code:
        }
        
        public static boolean add(Creature data) {
            //assert(allCreatures.containsKey(data.myid()));
    		log(DungeonRollcall.class.getClassLoader().toString());
    		log(Clan.class.getClassLoader().toString());
    		log(Creature.class.getClassLoader().toString());
            allCreatures.put(data.myid(), data);
            addedData = true;
            return true;
        }
    	
        
        public static boolean add(Group data) {
            assert(allGroups.containsKey(data.uuid));
            allGroups.put(data.uuid, data);
            addedData = true;
            return true;
        }
        
        public static boolean add(Clan data) {
            assert(allClans.containsKey(data.uuid));
            allClans.put(data.uuid, data);
            addedData = true;
            return true;
        }
        
        public static boolean add(DungeonRoom data) {
            assert(allDungeonRooms.containsKey(data.uuid));
            allDungeonRooms.put(data.uuid, data);
            addedData = true;
            return true;
        }
        
        public static boolean add(DungeonFloor data) {
            assert(allDungeonFloors.containsKey(data.uuid));
            allDungeonFloors.put(data.uuid, data);
    
            addedData = true;
            return true;
        }
        
        public static String uuid() {
            if (!addedData) {
                assert(false);
                log("old UUID not used");
            }
            addedData = false;
            return UUID.randomUUID().toString();
        }
    }
    I've tried making uuid field public before, it didn't work. Also removed getter, still didn't work. Can still access toString() of Creature from DungeonRollcall. Why? Please how do I fix?
    Last edited by VictorN; June 26th, 2021 at 06:53 AM. Reason: Inserted line breaks in the error message

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured