I created a new class. It is AdsClass.java. I added no existence class to check if compiler see my class.
Android studio must tell me about compiler error like NoExistanceClass not found. But Android Studio tells that everything okay and it installed my app on Android device.
How can I force the compiler to compile AdsClass?
package org.cocos2dx.cpp;
public class AdsClass {
public void showInterstitial() {
NoExistanceClass my;
}
}
My AdsClass.java path is
Settings.gradle
include ':libcocos2dx'
project(':libcocos2dx').projectDir = new File(settingsDir, '../cocos2d/cocos/platform/android/libcocos2dx')
include ':mahjongDroid'
project(':mahjongDroid').projectDir = new File(settingsDir, 'app')
my left pane
You are creating org.cocos2dx.cpp
package outside main/java
and by default Gradle default java source directory is src/main/java
so you can add your package to build path or there are few solutions as:
Add your new java package source to build path in
app/build.gradle
(app) usingandroid { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { // ... } sourceSets { // add package to path main.java.srcDirs += 'src/org/cocos2dx/cpp' } }
Or, you can move
org.cocos2dx.cpp
package/files insidesrc/main/java
packageYou can create a library module under your repo.
Example:
sourceSets { // add package to path
main.java.srcDirs += 'src/org'
}