问题
I keep getting this error (Upgrading old nbandroid project projectName FAILED. See log file for details.) for a few android projects in Netbeans. I'm not sure where to find the log the message refers to, I have checked every log I can find both in netbeans & system logs. To no avail, no more information.
I tried tracking down the score code and see what generates this error, I found this code (here: https://code.google.com/p/nbandroid/source/browse/project/src/org/netbeans/modules/android/project/AndroidProjectUtil.java?name=v1.5beta&r=d12ce88eb7d6a04ac55d0ae2bd8813fea1651bb4)
private static AndroidGeneralData findSDKAndTarget(
AndroidProject project, PropertyProvider props, FileObject nbproject) {
String platformName = props.getProperties().get("platform.active");
if (platformName == null) {
LOG.log(Level.INFO, "Cannot upgrade old nbandroid project. platform definition not found in project.properties");
return null;
}
FileObject storage = FileUtil.getConfigFile(PLATFORM_STORAGE);
String buildTargetPath = null;
if (storage != null) {
for (FileObject platformProvider : storage.getChildren()) {
buildTargetPath = parseIfActivePlatorm(platformProvider, platformName);
if (buildTargetPath != null) {
break;
}
}
}
if (buildTargetPath == null) {
LOG.log(Level.INFO, "Cannot upgrade old nbandroid project. platform {0} not found", platformName);
return null;
}
DalvikPlatform platform = toDalvikPlatorm(buildTargetPath);
if (platform == null) {
LOG.log(Level.INFO, "Cannot upgrade old nbandroid project. platform {0} not found in Android SDK", platformName);
return null;
}
AndroidGeneralData data = new AndroidGeneralData();
data.setPlatform(platform);
data.setProjectDirPath(project.getProjectDirectoryFile().getAbsolutePath());
data.setProjectName(project.getLookup().lookup(ProjectInformation.class).getName());
return data;
}
Leaving pretty much 3 possibilities, I have tried looking for all these, and as far as I can tell the data is present for all 3. I checked the project.properties, genfiles.properties and project.xml files, I would be happy to supply these if necessary.
Any tips or advice would be greatly appreciated, the projects work at the moment, but I would like to get rid of the annoying messages at start up.
I have now managed to track down the exact fault. The log file mentioned was well hidden in the netbeans directories (which had also changed place in netbeans 7.2).
I need the platform files in [netbeans file root]/config/services/platforms/org-netbeans-api-java-Platform
These are no longer available in anyway I can find, I also checked all old developer computers we have.
If someone has these platform files (I suspect they are xml files, from what I found) it would be greatly appreciated if they could send them to me. I should be able to modify them to make them work.
回答1:
It seems that the project update process failed to load Java Platform definition from a file that is somewhere in your netbeans userdir - http://wiki.netbeans.org/FaqWhatIsUserdir As a result it cannot set Android SDK location and find what is the target platform for your project. It is possible that the file/the settings was lost when you upgraded your IDE or for some other reason.
My suggestion is that you migrate your project manually. There is a hint in http://www.nbandroid.org/2011/02/beta-build-of-new-project-support.html remove nbproject directory and create an Android project as described in http://developer.android.com/tools/projects/projects-cmdline.html. NBAndroid recognizes this project structure and will be able to work with it. Or create this project in an empty directory and move your sources + resources there.
-Radim
来源:https://stackoverflow.com/questions/12748276/netbeans-nbandroid-upgrading-old-nbandroid-project-failed-see-log-file-for-de