File not found errors in Android

I’m no longer able to run the android version of my apps after upgrading Android Studio. I was previously able to run them, though only on a physical device. Now I get a number of errors. Among the first are:

cocos2d: fullPathForFilename: No file found at script/jsb_prepare.jsc.

and

cocos2dx typeerror: cc.class is undefined

Note that running the apps in XCode still works fine. This leads me to believe that the Android Studio/Gradle update caused items to no longer be found. Any ideas?

What version of Android Studio where you running and which version did you upgrade to? Which cocos2d-x version?

I don’t remember the version of Android Studio I was previously using but it wasn’t too old, maybe a few months. I’m now using Android Studio 3.2 and Cocos2dx version 3.17.

Also, if it helps, I noticed the intermediates/assets folder is empty. In looking at the build.gradle file, it looks like this is where the javascript source files are copied to, if you’re using js of course. Not sure if this is normal but the gradle file does have a copy command that appears to populate this folder so not sure if it’s ok for it to be empty.

It seems the fix was to make Android Studio use an older version of build tools.

I’ve a similar issue after upgrading to cocos 3.17, ndkr16, etc in Android Studio (c++). In iOS works.

Errors like:
error: package com.sdkbox.plugin does not exist in Cocos2dxActivity.java
error: cannot find symbol variable SDKBox in Cocos2dxActivity.java

error: package com.android.vending.expansion.zipfile does not exist in Cocos2dxHelper.java
error: cannot find symbol class ZipResourceFile in Cocos2dxHelper.java
error: package com.loopj.android.http does not exist in Cocos2dxDownloader.java
error: package org.cocos2dx.enginedata does not exist in Cocos2dxEngineDataManager.java
etc

It’s a hard work to upgrade apps in Android. In iOS it’s easy.

It’s not a solution, i want to use the lastest versions haha.

Agreed. I had no issues with iOS either, only Android. It worked after going back to build tools 27.0.2. I also went back to Gradle 3.0.0. I want the latest tools but I have to get the app working.

Thanks, however I solved the issue with Gradle 4.4 and build tools 27.0.3.
I copied proj.android and cocos2d from another project that works ok with cocos 3.17 and ndk16, i changed some parameters/configurations and now it works with this project. That’s all. But yes, in the past i fought a lot to make it work haha.

I have the same issue, the problem exactly is the build tool and gradle version update of android studio, painful these kind of bugs

1 Like