I want to use the UnifiedPreference library in my app. I've imported the library into my workspace, then added the new project into my existing project by adding it as a library under Properties -> Android. However I'm getting the following errors when I try to build my project which are coming from the UnifiedPreference project:
Console:
[2013-04-08 23:06:29 - unified-pref-library] ERROR: In <declare-styleable> PreferenceHeader, unable to find attribute icon
[2013-04-08 23:06:29 - unified-pref-library] ERROR: In <declare-styleable> PreferenceHeader, unable to find attribute title
The relevent logcat errors seem to be:
PreferenceHeader_title cannot be resolved or is not a field UnifiedPreferenceHelper.java /unified-pref-library/src/net/saik0/android/unifiedpreference line 435 Java Problem
PreferenceHeader_title cannot be resolved or is not a field UnifiedPreferenceHelper.java /unified-pref-library/src/net/saik0/android/unifiedpreference line 299 Java Problem
Have I imported the library incorrectly? I've tried cleaning and building both projects without anything changing.
In Eclipse:
On the Package Explorer
Right click in your Proyect > Properties
Select: Java Build Path
Select and enable Android Dependencies
Put on the top in the list
Click: OK
Figured it out, seems UnifiedPreference requires a dependency for ActionBarSherlock. Thanks to tttony for putting me on the right track though.
Related
I am following a tutorial Java EE Webapplication with servlet and jsp page
It is of an older Intellij version. Mine is Ultimate 2020 1.1 and has another way of servlet creation that confuse me. In the tutoriol a user gets this:
I get something with javax, without a long import list and with the error
How can I get the simple way that is shown in the tutorial? Is the 2020 1.1 IntelliJ version better? Why has it the error?
edit
What I am doing exactly is this: after creating a simple jps file called login.jps, I press an item in a IntelliJ menu to create a servlet:
Then I fill out a form in this way and press OK:
Then the login.java file with the login class is created automatically. But the file differs from the tutorial one, because is related to the javax symbol.
You have "red" unresolved code b/c there is no such library added to project. You need to add servlet-api dependency to module, see Add a library to module dependencies
steps:
Global and project libraries are not available until you add them to module dependencies:
From the main menu, select File | Project Structure ⌘; and select Modules.
Open the Dependencies tab and click Add.
Select a library you want to add and click Add Selected at the bottom of the dialog.
from the beginning, while trying to deploy a war under Jetty, I have an error, and in order to understand from where the error is comming, I would like to put a breakpoint in a class (SimpleCDI) located in a dependency (a jar which is downloaded by MAVEN). I work under MAC and when I hit Command + Shift + T and look up "SimpleCDI" class, it points that the class is within org.jboss.weld package
Here is a printscreen of my research
And when I click on the "C SimpleCDI org.jboss.weld" line, it returns an error message
org.eclipse.core.runtime.CoreException: The class file is not on the classpath
at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor.doSetInput(ClassFileEditor.java:694)
at org.eclipse.ui.texteditor.AbstractTextEditor$5.run(AbstractTextEditor.java:3154)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:437)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:353)
at org.eclipse.ui.internal.WorkbenchWindow$14.run(WorkbenchWindow.java:2195)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2191)
at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3172)
I checked that I have the right dependency (weld-servlet-2.4.5.Final.jar) with
SimpleCDI" in it.
I noticed that the eclipse icon of my dependency "weld-servlet-2.4.5.Final.jar" is the following
It is a jar file without attached source. Actually, I can see this dependency in Eclipse in one of my module "Tourism-Services" (I have a Maven multi module project) in the "Referenced Librairies" folder with the icon mentioned above, but the Maven dependency that import this jar is located in another module "Tourism-Core" which is imported itself in "Tourism-Services" module. I notice in passing that I cannot see "weld-servlet-2.4.5.Final.jar" in "Referenced Librairies" folder of "Tourism-Core" module (why ?)
My main question is : why cannot I edit "SimpleCDI" class and put a breakpoint in order to debug upstream
I've also been using the CodeMix plugin, have you tried to remove the Open Type binding from the CodeMix preferences? Preferences -> Codemix -> Bindings. From there uncheck the "Open Types on COMMAND+SHIFT+T" and do apply and close. This will get you to use the regular Open Java Type from Eclipse.
Cheers
a plugin was causing the error. It is CodeMix plugin
I tried to uninstall it : help->Eclipse Marketplace->Installed
I obtain the following screen
I chose uninstall in the dropDown
But it doesn't work.
I have found a workaround : https://www.genuitec.com/forums/topic/uninstall-codemix/
But it is temporary. I tried to find CodeMix in Eclipse plugin folder (I work under MAC), but there is nothing. Do you see another way ?
I'm trying to integrate these libraries into my Android project to make a navigation controller.
When I add in these two lines to my build.gradle -
implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha01'
implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha01'
It syncs ok, but in build I get this error:
ERROR: In NavArgument, unable to find attribute type.
I was able to build Google's sample project that uses the relevant libraries without problems.
My project has:
androidSupportLibrary 27.1.1
projectTargetVersion 27
projectCompileSdkVersion android-P
projectBuildToolsVersion 27.0.2
gradleVersion 3.0.1
gradlePlugin 4.4
I've already tried upgrading all these versions^, doing a clean build, restarting Android Studio, etc.
I also get some Java compiler errors.
Any thoughts on why this might happen?
You need to add the navigation value in your project :
add navigation xml
and after that, if you have an error
invalid resource directory name: ..../res/merged/debug navigation
you need to remove android.enableAapt2=false from your gradle.properties
my project requires BaseGameUtil library
I have BaseGameUtil library downloaded form here
But when i import it in my android project it doesnt show baseGameUtil instead it shows main as added in my eclipse project and even when i add that main library i still get the same error.
Can anyone help me.
I think you may be using the version of BaseGameUtils in here:
...\android-samples-master\BasicSamples\libraries
But you are using Eclipse so you need to use the one in the following location:
...\android-samples-master\eclipse_compat\libraries
You may then also encounter an error with the GameHelper.java class in the BaseGameUtils folders. Use the code available here instead: https://gist.github.com/EmmanuelVinas/ef09a35bcc805ba6deb3
BaseGameActivity cannot be resolved to a type
public Class FisrstActivity extends BaseGameActivity{
In your project, right click > properties > Android > in Library section check if your library is correct and don´t show any red cross.
Check the same for your BaseGameUtils library, probably the reference to google_play_services is incorrect.
you problem must be similar to : android - import - with developers google com games
Basegameutils from github includes all source .java files in java folder. When implementing in eclipse, move all these folders from 'java' to 'src'. Eclipse compiles them to produce .class files which fixes this problem.
I am attempting to incorporate admob ads in my app. So far I have added the following code
in the onCreate method of my app's main activity...
adView = new AdView(this,AdSize.BANNER,"my code number");
adView.loadAd(new AdRequest());
The program compiles without error but at run time I get the message java.lang.NoClassDefFoundError: com.google.ads.AdView. I have seen a supposed explanation of the problem and the cure here but I could not see how it was applicable to my project because I do not have either a "lib" or "libs" directory within my project.
According to eclipse's SDK manager, I have the most up to date version of everything that I use.
I had a similar problem, but did not have to add the libs folder; I tried, with no success, then removed them afterwards, when I realized that I had just forgotten to export the included Jar archived.
Fix:
Select project settings > Java Build Path, then Order and export.
Here, check the GoogleAdMobAdsSdk-package.
This should solve the NoClassDefFoundError-issue.
Just create manually the "libs" folder, and add your libraries there. By default, they doesn't exist
Project-> Clean
Project settings -> Java Build Path. Open "Order and export" tab.
Check GoogleAdMobsAdsSDK.
It is worked for me.
Was getting this error updating from android 16 to 20.
Solved by going to Java Build Path, Order and Export tab, checked and moved GoogleAdMobAdsSdk just under my source. For some reason that fixed it.
Changing the order back didn't break it. So some setting must have needed to be initialized.
I had this problem, and this problem too:
Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode and Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode
Despite many hours of following all solutions listed the only way I could get my app to work was to use the AdMob banner example here:
https://github.com/googleads/googleads-mobile-ios-examples/tree/master/admob/SmartBannerExample
And re-build my project around it, copying my files in to that project. If you are stuck, try it.
Don't know why it worked, but now it does. Something in my project was very wrong. Now I can carry on with my work. I love Google/Android, but really what a mess!
See this answer Android update 17 seems incompatible with external Jars.
You need to put all jars in libs folder insted of lib.
It's not enough only to add "GoogleAdMobAdsSdk-6.4.1.jar" in Java Build Path,then you should switch to table:Order and export.check the "GoogleAdMobAdsSdk-6.4.1.jar" here.
UPDATE:
Select project settings > Java Build Path, then Order and export.
Here, check the google-play-services.jar.
This should solve the NoClassDefFoundError-issue.
In my case I needed to click on the "Android Private Libraries" on the "Order and Export" Tab
Go to Properties - Java Build Path - Order and Export and check every Checkmark! That did the trick for my project.