java - .get() and .put() methods migrated from Eclipse to Android Studio -
i quite .net guy, developing in xamarin. however, got hands on piece of java code android implement in c#. problem project developed in eclipse, , ported android studio , cannot compiled.
i got through issues gradle, stuck generated annotations , .put()
, .get()
methods, cannot referenced. there many things similar following:
a normal interface mysharedpreferences
has generated sealed (final) class counterpart mysharedpreferences_
. used in code:
import com.someproject.mysharedpreferences_; ... public class someandroidclass { public mysharedpreferences_ prefs; public somemethod() { string x = prefs.somevalue().get; ... prefs.somevalue().put("abc"); } }
now, cannot compiled, because mysharedpreferences_
class not generated android studio. tried rid of underscore , use mysharedpreferences
interface instead. had problem referencing .get()
, .put()
methods. please, can me how deal problem?
edit
adding build.gradle
file:
buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } repositories { maven { url "http://dl.bintray.com/populov/maven" } mavencentral() mavenlocal() } apply plugin: 'com.android.application' apply plugin: 'android-apt' def aaversion = '4.0.0' android { compilesdkversion 23 buildtoolsversion "23.0.3" defaultconfig { applicationid "com.testproject.smartconfig" minsdkversion 15 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { apt "org.androidannotations:androidannotations:$aaversion" compile "org.androidannotations:androidannotations-api:$aaversion" compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.3.0' compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar' } apt { arguments { androidmanifestfile variant.outputs[0]?.processresources?.manifestfile } }
mysharedpreferences_ class generated android annotations library - androidannotations.org, check if build.gradle contains needed config: https://github.com/excilys/androidannotations/wiki/building-project-gradle
then reimport project using gradle.
Comments
Post a Comment